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 end if Torso.Velocity <= 50 then P.CanCollide = true end end
The problem is that you're using >= 50 AND <= 50 for both statements. You can't say that you want the part to be noncollide for players going 50+ and cancollide for players going 50- because if a player is going at 50 evenly the script won't know what to do. To fix this, you'll want to either change <= 50 to < 50(49-), or <= 49, like I did here:
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 the player is 50 or above the part is noncollide. if Torso.Velocity < 50 then P.CanCollide = true end -- If the player is below 50(49-) the part is cancollide. end