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

Help! my velocity script won't work?

I'm trying to make a script where if a car is going over 70 AND it hits a part (yes, it destroys all the models children) it will BreakJoints(). Except that doesn't happen. It worked fine without the velocity part. Anyone help?

function onTouched(hi)


local Speed = 70

	if script.Parent.Parent.Parent.VehicleSeat.Velocity.Magnitude >= Speed then
script.Parent:BreakJoints()
script.Parent.Parent:BreakJoints()



end end



connection = script.Parent.Touched:connect(onTouched)

2 comments

0

Try using lowercase for magnitude like: Velocity.magnitude. I'm not 100% sure, maybe there has been added Magnitude, but case matters.

0

nothing happens, it's not that but thanks

1 answer

The code seems fine so the issue should be the implementation/theory. Have you checked the value of Velocity.Magnitude? Print this out before your if statement, as this will be the true indicator as to why your if statement never equals true.

1 comment

0

I tried that. Nothing prints.

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