Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

4 comments

0

Are you receiving any errors in the output?

0

Yes, it says that the 2nd interval is empty, but I dont think it is.

0

Make sure they both arent 0 or the same number.

1

Yeah - I just realized I made the higher number way lower than the lower one, thanks for help!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.