Help with Cloning

help

I’m trying to spawn one cat every second. My script only teleports the cat, this is because of my position line of code but I thought it would create another cat. How do I make a bunch of cats spawn not teleport as one?

Well this is just moving the cat in a random world position. You wanna get the player and do
local SpawnRange = Player.Character.PrimaryPart.CFrame * math.random(1,100)

When calling CatMesh:Clone() save that to a variable, and then use that variable to index the object. Otherwise you are just indexing the reference model.

local CatMeshClone = CatMesh:Clone()
CatMeshClone.Parent = workspace
2 Likes

This work’s, what I’m getting out of this is that I kept calling the one clone and changing it’s position?

Yes, since it all matters about what your variables are indexing. In the top of your script you defined CatMesh as Clonables:WaitForChild("CatMech"). So everytime you use that variable, that’s the object that it will go to.

When you call :Clone() and index that to a new variable, the game knows you’re wanting to reference the clone you just created.

To change the position more than one. You are using math.random right? So you will have to repeat the math variable every time when a cat spawns so you will get more results.

I noticed that problem and solved it, thanks for mentioning it.