I've made a model and i want to know how to spawn a model in a random place around a map. does it go with?
local .. math.random() or is it something else?
I've made a model and i want to know how to spawn a model in a random place around a map. does it go with?
local .. math.random() or is it something else?
Well, I made it so it spawns anywhere. If it was my place this script would be inserted into, I would specify within which area it should spawn. Here's you're script fixed up:
game.Workspace.Model:MoveTo(Vector3.new(math.random(),math.random(),math.random()))
Here's my opinion
game.Workspace.Model:MoveTo(Vector3.new(math.random(1,100),0,math.random(1,100)))
I made it so it can spawn on the X axis between 1 and 100, the Y axis at 0 (Don't want it floating) and the Z axis between 1 and 100.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
how about height?
The Y axis is height. You could make it "math.random(1,10)" because I don't think you'd want it to randomly be in space. The Y axis is where the "0" is by itself.