Cloner only spawns model once

Okay, so I made a model cloner, and apparently it only spawns the model once.

What is the issue?

	local model = game.ServerStorage.Model:Clone()
	model.Parent=game.Workspace
	model.Position = Vector3.new(-54.3, 87.659, 141)
	
	wait(0.2)
end```

Well yeah the part of code you posted would only clone it once, is there any loop above or something?

2 Likes

There isn’t, but I’m relatively new to scripting so yeah, didn’t know that was the issue so I will look into it, thank you!

1 Like

Try this @gloows. (30 charrrrr)

Okay, I will try.

aaaaaaaa (30 char)

The code above would infinitely spawn the model every 0.2 seconds just in case you didn’t know. In order to spawn it n amount of times you could do this;

for i = 1, 10 do --replace 10 with the amount of models you would want
	local model = game.ServerStorage.Model:Clone()
	model.Parent = game.Workspace
	model.Position = Vector3.new(-54.3, 87.659, 141)
	wait(0.2)
end

Wait I just noticed that I did use a loop and it somehow didn’t copy, and it still doesn’t work?

So this the code currently:


local model = game.ServerStorage.Model:Clone()

model.Parent=game.Workspace

model.Position = Vector3.new(-54.3, 87.659, 141)

wait(0.2)

end```

What’s the end at the bottom of your code for?

Yeah that’s what I want it to do, spawn infinitely amount of times, but the code doesn’t do that.

Are you getting any errors in the output?

Yes, I got this:

image

1 Like

Oh yeah how didn’t I notice that before, try this instead

local model = game.ServerStorage.Model:Clone()
model.Parent = game.Workspace
model:SetPrimaryPartCFrame(CFrame.new(-54.3, 87.659, 141))

Note: make sure your model has a primary part set.

1 Like

How would I set it to a primary part?

(Apologies, I’m new to this kind of stuff and I’m currently learning)

Select your model, go to it’s properties and press “PrimaryPart” property

1 Like

But the model has multiple parts?

Yeah, just set it to one of them which would be the main part of that model. The position of your model will depend on the position of PrimaryPart then.

1 Like

Okay, there isn’t really a main part but I’ll just set it to a random part.

Wait, what’s your discord?

It’ll be easier to chat there.

Well it’s not really a main part, my bad, it’s just like a anchor point of your model.

You can add me on discord: rok#2003

Oh, the model isn’t supposed to be anchored.