This is a script I made that if the part touches something and its X velocity is higher than 20 it prints "touched" but I realized that the numbers would go into the negatives. How would I find the speed of the part without it going into the negatives?
local vel = script.Parent.Parent.Parent.Parent.Part.Velocity.X local minvel = 20 script.Parent.Touched:Connect(function() if not debounce then if vel > minvel then debounce = true print("touched") wait(0.5) debounce = false end end end)
In order to make the velocity positive, you can use the math.abs() in the math library.
local vel = script.Parent.Parent.Parent.Parent.Part.Velocity.X local minvel = 20 script.Parent.Touched:Connect(function() if not debounce then if math.abs(vel) > minvel then --It will become an absolute value. debounce = true print("touched") wait(0.5) debounce = false end end end)