Basically it's designed for a vehicle, if the vehicle is going over 50 SPS, the part detects it and cancollide = false, and back to cancollide = true if it's under. Except this doesn't happen. What have I done wrong?
P = script.Parent Player = game.Players.LocalPlayer Human = Player.Character Torso = Human.Torso while true do wait(.05) local intSpeed = math.floor((Torso.Velocity.magnitude)/1.6) if Torso.Velocity == > 50 then P.CanCollide = false if Torso.Velocity == < 50 then P.CanCollide = true end end
On line 10 and 11, you use == >
and == <
. These are not valid operators.
Use >=
for "Greater or equal to"
And <=
for "Smaller or equal to"
Also you seem to be missing some end
s.
Try this:
P = script.Parent Player = game.Players.LocalPlayer Human = Player.Character Torso = Human.Torso while true do wait(.05) local intSpeed = math.floor((Torso.Velocity.magnitude)/1.6) if Torso.Velocity >= 50 then P.CanCollide = false end if Torso.Velocity <= 50 then P.CanCollide = true end end