Here is another simpler way, the seat has an awesome property called occupant, which is whoever sat on the seat, if no one is currently sitting, it will be nil. So if we use this with a .Changed event which checks if a property has changed. We can check if the occupant property has changed, and if it has changed and the occupant is a player, we set his jumppower to 0!
And btw, your script is actually right, but the if statments are only checking once if the humanoid sitting, because if statments always check a condition once, so you have to put them inside of a loop or something so they contanly check. But this way is more efficient I think.
The paramater for the changed event is whatever property was changed. And the occupant is actually the humanoid that is sitting.
local seat = script.parent
seat.Changed:Connect(function(prop)
if prop == "Occupant" then
if seat.Cccupant:IsA("Humanoid") then
local humanoid = seat.Occupant
humanoid.JumpPower = 0
end
end
end)
And that should work!
4 comments
Did you parent this script into a seat, If so why not try script.Parent.Touch function?
maybe you're right i will try that
It did not work, here is the code i tried:
local seat = script.Parent seat.Touched:Connect(function(hit) local char = hit.Parent local hum = char.Humanoid hum.JumpPower = 0 end)