Jump Lock for Bus

I want the bus driver to be able to turn on jump lock.

Basically, how it would work is - the driver would have a GUI button to enable/disable the jump lock.

When the lock is enabled - all the players who are seated in the bus’ passenger seats couldn’t jump out from the seats. If disabled - they would be able to jump out.

How would I do that though?

Make a event for the driver to enable or disable jumplock, when the driver fires the event loop through all of the players in a bus and set their jumppower to zero and the opposite when the driver unlocks.

does zero jump power still allow people to jump out of seats though?

Yes, when the players arent able to jump they wont be able to leave seats

Just tested it, you are correct

1 Like

That’s a good idea, but how would I do it so players who sit AFTER the button has been pressed can’t jump aswell?

Put a bool value inside the bus named IsLocked. Create a main script in the bus to loop through the seats, create an event for sitting and change the jumppower to 0 when someone sits. Also you can make the main script unlock all the seats when the bool value is changed back to false

Is it possible to do a :GetPropertyChanged(“Occupant”) instead of a loop, but for it to detect all parts?

Yes loop for all seats and do this

for i, seat in pairs(seats:GetChildren()) do
seat.Changed:Connect(function()
-- set jumppower to 0 of the occupant
end)
end
1 Like