Today I was making a game and I want it so that when a player sits down they freeze. I’ve tried making it so that when they touch the seat they freeze but sometimes they dont actually sit down. I just want to learn how to make a function that when someone sits it freezes them (makes jump power 0 and walk speed 0)
1 Like
You can use the Occupant property of the seat.
local seat = script.Parent
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local humanoid = seat.Occupant
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
end)
1 Like
Awesome! Thank you so much!
No problem! Just add an if statement to check that the humanoid exists before you adjust the properties.
if humanoid then
-- change properties
end
1 Like