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

Why wont this simple few lines of code work? Not argent/can wait.

Asked by
Dr_Doge 100
9 years ago

So I tried to create my own random tree spawner, but its not working. Its not argent, but can someone tell me why?

while true do
h = game.Lighting.Tree:clone()
h.Parent = game.Workspace
h:MoveTo(math.random(),(10),math.random())
wait(1)
end

Can someone Help me?

1 answer

Log in to vote
0
Answered by 9 years ago

math.random() accepts two arguments: minimum and maximum.

while true do
h = game.Lighting.Tree:clone()
h.Parent = game.Workspace
h:MoveTo(Vector3.new(math.random(-50,50),10,math.random(-50,50))) -- -50 is minimum position, and 50 is max.
wait(1)
end
0
To extrapolate on this answer some, MoveTo doesn't take three numbers, it takes a ROBLOX type called a Vector3. adark 5487 — 9y
Ad

Answer this question