The script itself is pretty much self explanatory, I have a model with multiple carts and seat in it. The script should change the jump power of every player sitting in any seat to 0 so they cannot jump. Unfortunately this doesn’t seem to work. When I made print statements to give out if there is an occupant the script told me that every seat already has an occupant, but in the next step never sets the jump power of a humanoid. There are no errors at all in the console too.
I’d greatly appreciate any and all help.
local function restrictJumpPower(cart)
for _, seat in pairs(cart.Car.Colour:GetChildren()) do
if seat:IsA("Seat") then
local occupant = seat.Occupant
if occupant and typeof(occupant) == "Instance" and occupant:IsA("Player") then
local humanoid = occupant.Character and occupant.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid.JumpPower = 0
end
end
end
end
end
while true do
for _, cart in pairs(script.Parent["Cart Ride"]:GetChildren()) do
if cart.Name == "Cart" then
restrictJumpPower(cart)
end
end
end