I’m trying to make a system in my game (like other popular games) where players get seated in a list of chairs (models with seat parts in them.) how would I make a system like this to seat them when the round starts and unseat them when it is over?
Make a Folder with seats.
Iterate over all players.
Get a unoccupied seat. (Seat.Occupent == nil)
Make Player sit. ( Seat:Sit(humanoid) )
Disable player jump ability.
Profit.
If you only want users to be able to seated through a controller script you should do the following:
- Create the seat instances and either put them all in 1 folder or tag them with CollectionService so you can fetch them (if you don’t want users to be able to manually sit you should disable CanCollide, CanTouch and CanQuery).
- Iterate through all players and seat them in them different seats.
- Disable jumping (I will add a script below to toggle jumping)
- De-seat using scripts them by setting their Humanoid.Sit to false.
-- Disable Jumping:
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
-- Enable Jumping:
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
-- Manually seat a humanoid:
local seat = workspace.Seat
seat:Sit(humanoid)
-- Manually de-seat a humanoid:
if humanoid.Sit then
humanoid.Sit = false
end
By disabling CanQuery, CanCollide and CanTouch you make it impossible for the user to sit down unless forced by a script.
It’s Seat:Sit(humanoid)
seat:FindFirstChild("SeatWeld"):Destroy()
See documentation
My mistake, I do this in my own game, I have edited my response - I previously helped someone do this exact same thing but with NPCs ![]()
Also, correct me if I’m wrong but setting a humanoid.Sit to false it automatically breaks the SeatWeld regardless?
Tested it myself, yea setting .Sit on the humanoid to false automatically destroys the seat weld.
Both methods are viable, the more you know. ![]()
Thank you and also Julian. I’ve gotten it figured out but sadly racked my brain by going crazy on why the player could still jump. (I was using jumpPower instead of JumpHeight) ![]()
Good to know. Why does 30 (blocked word) limit exist?
