Hello. I am trying to disable the player from exiting a VehicleSeat once they enter. I have tried setting their JumpPower to 0 and this current code disables jumping once they are in the seat. The print statement on line 39 prints as expected, but I am still able to leave the seat.
local seat = script.Parent
if not seat then warn("No seat") end
local function onSeatChanged()
local occupant = seat.Occupant
if occupant then
print("occ found")
local char = occupant.Parent
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then
hum.UseJumpPower = true
hum.JumpPower = 0
print('disabled')
end
end
end
end
seat:GetPropertyChangedSignal("Occupant"):Connect(onSeatChanged)
Just replace the seat with vehicle seat
The reason is that we have to tell the game we wanna use jumppower before setting it