I’ve been trying to change the position of a model randomly but I can’t find out how.
Here is the script that I have:
while true do
task.wait(0.1)
local ss = game.Workspace["Solar System"]:Clone()
local pos1 = math.random(1,250000)
local pos2 = math.random(1,250000)
local pos3 = math.random(1,250000)
local WhereItShouldGo = Vector3.new(pos1,pos2,pos3)
ss:MoveTo(Vector3.new(pos1,pos2,pos3))
ss.Parent = game.Workspace.Planets
end
All you need to do is set the parent of your model before you move it.
One line of your code was also unnecessary since you are just setting the position itself.
while true do
task.wait(0.1)
local ss = game.Workspace["Solar System"]:Clone()
local pos1 = math.random(1,250000)
local pos2 = math.random(1,250000)
local pos3 = math.random(1,250000)
ss.Parent = game.Workspace
ss:MoveTo(Vector3.new(pos1, pos2, pos3))
end