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

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

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

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

1 comment

0

To extrapolate on this answer some, MoveTo doesn't take three numbers, it takes a ROBLOX type called a Vector3.

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