Trying to clone a model 10 times and move it 15 studs from previous clone

I’m trying to clone a model and use :MoveTo to move it 15 studs away from the previous clone.
The thing is, it can get the proper position… but it just doesn’t move the model and I can’t figure out why.
I’ve tried rewriting it multiple ways but no matter what I do, the problem remains that the cloned models don’t move to the positions given. Here’s the code:

local folder = script.Parent
local OGsmash = folder.SmasherD --The model I'm cloning

local distance = 15 --Distance away from the previous clone

for i=1,10 do
	task.wait(2)
	local clone = OGsmash:Clone() --Clones the model
	local goal = OGsmash.PrimaryPart.Position + Vector3.new(0,0,distance) --Creates a new position based on the previous model/clone location
	clone:MoveTo(goal) --Here lies the problem. It won't move it to the position. I've tried SetPrimaryPart and PivotTo as well.
	clone.Parent = folder
	distance += 15 --Adds 15 studs to the distance so the next clone moves further
end

Basically, this code just takes the Model in workspace, clones it, creates a position 15 studs away, moves the clone there, adds an extra 15 studs to the distance, then the code loops and the next clone is moved 30 studs away instead, creating a row of models.
I know this code might just be chicken scratch, I’m very VERY new to scripting. Could anyone help me figure out how to actually move the model? (Yes, the model has a PrimaryPart)

1 Like

NVM fixed it, had to use :PivotTo instead cause :MoveTo is goofy and apparently the clone has to be in workspace first, so I just moved clone.Parent = folder above :PivotTo

Of course I figure this out right after making the post bruh :skull:

1 Like

Yeah Model:MoveTo() should only be used when teleporting characters. It safely positions them by moving them up until there’s no clipping with other parts.

2 Likes

That explains… a LOT. Many thanks, the two of you

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.