Make a random rotational velocity?

So I’m making a dice game But I had some trouble deciding how the dice should roll. I eventually decided The dice should float up and roll themselves in the air without actually rolling on the ground. I determined to do this by inserting a body velocity into the dice that with hover them in the air. I understand how body velocities work but I’m not so sure about rotational velocities. How would I go about making the dice roll in the air in random directions?

1 Like

You should use a BodyAngularVelocity, and randomize each value in the Vector3.

Kinda like this:

local vel  ='BodyAngularVelocity')
vel.Parent = (the dice basepart or primarypart)
vel.AngularVelocity =,180),math.random(1,180),math.random(1,180))

It doesn’t quite seem to be random :confused: Both the dice look like they rotate at the same angle.

Try using with different seeds. For example you could use tick() for one seed, and tick()+100 for the other one. Since you’re probably rolling the dice at the same time, both of the random seeds are the same since they occur on the same tick.

How does tick() work? I’m not quite that advanced yet :sweat_smile::sweat_smile:

tick() is just the amount of seconds that have passed since 1970, January 1st. If you use this seed twice at the same time it will have the same result, which im guessing happened with your dice?

If that doesn’t work pls show me the code you used.

Yes, the dice do roll in the same direction at the start although it does appear to be random. The player’s may be annoyed that it looks like the dice start off rolling the same direction. I’ll try the with tick() to see if that makes it look better.

Whenever I try to print[random number]) it returns the string "Random"

edit: I’m not quite familiar with yet

Use Random:NextInteger(min,max)

Edit: Example:

local rand =

Think of as a service even though it isn’t. NextInteger would be a function of the service.

local MinimumNumber = 1
local MaxNumber = 10

local RandomService =
print(RandomService:NextInteger(MinimumNumber, MaxNumber)

— Anything between 1 - 10 will be printed. 

Thank you. One question though, what is the difference between using Random:NextInteger and math.random()?

Random is more random than math.random(). Also, if you use Random:NextNumber(), you get decimals also.

1 Like