Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need a part that cancollide = true if it's under 50 speed, and cancollide = false if it's over?

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

2 comments

0

You could try repeat wait() until Torso.Velocity >= 50

0

I don't get that, I don't really know lua. Could you help further?

1 answer

Simply take out torso and velocity and use humanoid walkspeed.

This discussion is preserved as it was. New answers, comments, and votes are closed.