I have a detector server script for a part (located in the WS). It works sometimes, other times it doesn’t. It is supposed to, after the part is touched, sit the player down in a seat, which it does, the only problem is it does not change the jump power. I have tried changing to it a WaitForChild and regularly, it doesn’t work either times. If I try changing the WalkSpeed to 0 after a touch, it works good. Lastly, I tried what Roblox reccomends you do, use SetStateEnabled… that didn’t either. Is there something wrong with how I am locating the humanoid? Wouldn’t I get an message in the output?
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
-- Find seat
local truckSeats = script.Parent.Parent.Truck.Seats:GetChildren()
for i, v in pairs(truckSeats) do
if not v.Occupant then
-- Seat the player in the seat
v:Sit(plr.Character.Humanoid)
-- This line below gives no error, it just doesn't work. plr.Character.Humanoid:WaitForChild("JumpPower").Value=0
game.ReplicatedStorage.ShowExitGUI:FireClient(plr)
break
end
end
end
end)
edit: added comment to code for more clarity