How could i randomize a vector 3 value?

Hello! I have a script in a part that when touched clones another Part, and everything works perfectly, but i have one issue, the parts collide with eachother time to time making a big mess, and i want to make it have a random vector 3 value in a 230x230 Baseplate (my map’s current size).
Any idea on how to achieve this?

It would be pretty easy. Just use random components for the Vector3 like this:

local randomVector = Vector3.new((math.random()-0.5)*xRange, (math.random()-0.5)*yRange, (math.random()-0.5)*zRange)
1 Like

I only want the X and Z coordinates, so it doesn’t randomize it’s height aswell, so for that should i remove the Y value randomizer? because if i do this it would pick up the Z value as the Y value.

I don’t know what you mean with the last part, but just set it to zero I guess.

nvm, i figured out how to do what i was trying to do, but thanks anyways!