Ad
Log in to vote
0

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

Asked by 3 days 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? Vong25 187 — 3d
0
Yes, it says that the 2nd interval is empty, but I dont think it is. Canturion 6 — 3d
0
Make sure they both arent 0 or the same number. brodywth 97 — 3d
1
Yeah - I just realized I made the higher number way lower than the lower one, thanks for help! Canturion 6 — 3d

1 answer

Log in to vote
0
Answered by 3 days ago

Make sure they both arent 0 or the same number.

Ad

Answer this question