The script is supposed to print something if a car is going at 40 speed. Heres the script:
while wait() do
local speed = script.Parent.Velocity.Magnitude
if speed == 40 then
print("you are going too fast")
end
wait()
end
The script is supposed to print something if a car is going at 40 speed. Heres the script:
while wait() do
local speed = script.Parent.Velocity.Magnitude
if speed == 40 then
print("you are going too fast")
end
wait()
end
Instead of speed == 40 do speed >= 40 because the way you increase speed may make the speed go over 40, while skipping it. (like if you increase the speed by +3 or any number thats not a divisor of 40, the speed will never equal 40).
Thanks you so much, it worked!
does it work without while wait() do?
you can make it so that it checks every time the speed changes with the :Changed event
on what variable do i need to do that?
on the magnitude, of course
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Loops won't work at all. And if speed == 40 causes the error. try <= instead?
That sadly didnt work.
just because loops won't work.