Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use number values in my math.random() statement?

Asked by 2 years ago

Hello, I need help, I need to use math.random() in my script and to make it easier to customize, I made the lowest and highest number a number value, but it doesnt work, is there any reason why?

return function()
    while true do
        wait(script.Parent.Parent.WaitDelay.Value)
        local lowest = script.Parent.Parent.LowestSpeed.Value
        local highest = script.Parent.Parent.HighestSpeed.Value
local speed = math.random(lowest,highest)
script.Parent.CylindricalConstraint.AngularVelocity = speed
    end
end

Thanks.

0
Are you receiving any errors in the output? COUNTYL1MITS 312 — 2y
0
Yes, it says that the 2nd interval is empty, but I dont think it is. Canturion 6 — 2y
0
Make sure they both arent 0 or the same number. brodywth 97 — 2y
1
Yeah - I just realized I made the higher number way lower than the lower one, thanks for help! Canturion 6 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Make sure they both arent 0 or the same number.

Ad

Answer this question