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

How would you generate random Vector3 Positions within a specified range?

So I am trying to teleport a brick to a random location on top of a brick, the bricks position that im trying to teleport the other brick on top of is

30, 0.5, -38

The brick is teleporting fine but what I need help with is generating a completely random location within the position of the brick that im teleporting the other brick too, the brick is of size:

78, 1, 68

The code for generating the random numbers is as follows:

x = r:NextInteger(100,30) / 10
y = r:NextInteger(0, 100) / 10
z = r:NextInteger(200, -38) / 10

My friend recommended me to use these parameters divided by 10 to get the random points inside of the brick. Any help is much appreciated :)

(r is the random object created earlier in the code)

Thank you

1 comment

0

Sorry if my grammar is not that great or some of this might be confusing I am half asleep. If you would like me to clarify or post more code(i dont think you will need more code) then just let me know

1 answer

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