For a little thing I am making. I've seen click-to-(action) things in the past and thought they were much cooler. For chairs, I think it's just kind of "buggy" to just walk up to a chair and walk ontop of it to sit. Does anyone have any idea how to work this?
A type of BasePart that a player character can ‘sit’ in. When a character touches an enabled Seat object, it will be attached to the part by a Weld and the default character scripts will play a sitting animation. How do Seats work?When a model containing a Humanoid and a BasePart called ‘HumanoidRootPart’ (generally a player character) touches a seat, a Weld is created between the seat and the part. The JointInstance/C0|C0 and JointInstance/C1|C1 properties are configured so that the character is welded 2 studs above the seat. This weld is named ‘SeatWeld’ and parented to the seat. When sitting the Seat/Occupant property is set to the Humanoid that is ‘sitting’ in the seat. Furthermore the Humanoid/SeatPart property of the humanoid is set to the seat. A character can also be forced to sit in a seat using the Seat/Sit function. There are two ways for a character to get out of a seat. When a player jumps, they are removed from the seat. However this can also be done manually by destroying the seat weld, for example: seat:FindFirstChild("SeatWeld"):Destroy()Note seats have a cooldown (currently 3 seconds) that is on a per-character per-seat basis. This means once a character has gotten out of a seat they cannot sit back on the same seat for 3 seconds. This cooldown behavior may change and should not be relied upon by developers. What can Seats be used for?Seats have a diverse range of uses, ranging from the obvious to the more unconventional.
Inherited from BasePart: Show Hide
Inherited from PVInstance: Show Hide
Inherited from Instance: Show Hide
Inherited from BasePart: Show Hide
Inherited from PVInstance: Show Hide
Inherited from Instance: Show Hide
This code sample includes a demonstration of how the Seat/Occupant property can be used to track which player is sitting in a seat and when they sit down or sit up. |