Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I've made a Model and i want to know... how do i make a model spawn in a random place?

Asked by 10 years ago

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?

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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.

0
how about height? thejeterman 0 — 10y
0
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. Shawnyg 4330 — 10y
Ad

Answer this question