What do you want to achieve? Ball that bounces 200% but with a speed limit
What is the issue? ball gets so much speed it clips out of the world (in a closed room)
What solutions have you tried so far? I tried making a while true loop that checks if speed is higher than an amount but it didnt work
Im kinda bad at scripting but here
local ball = script.Parent
local cap = false
ball.Touched:Connect(function(object)
if not cap then
if object:IsA("Part") then
ball:ApplyImpulse(ball.AssemblyLinearVelocity * 0.4)
end
end
end)
while true do
local power = ball.AssemblyLinearVelocity.Magnitude
task.wait(.3)
if power >= 40 then
cap = true
else
cap = false
end
end
You can integrate it by using it as a capacitor, math.clamp() uses the following arguments:
math.clamp(Value, Min_Value, Max_Value). If the value is below minimum, default to minimum. If it’s above maximum, default to maximum. If not, it’ll just use the number you provided.