Problem with Cloning Rig

  1. What do you want to achieve? Keep it simple and clear!

I’m simply trying to clone an NPC for testing purposes.

  1. What is the issue? Include screenshots / videos if possible!

Code:

local serverStorage = game:GetService(“ServerStorage”)
local mob = serverStorage:FindFirstChild(“Rig”)
local clone = mob:Clone()

local testFolder = workspace.TestFolder

while true do
	wait()
	clone.Parent = testFolder
	print("cloned character")
end

return

For some reason it not cloning, I have tried cloning it from ServerStorage into a folder which should parent it to workspace, but that didn’t work, so I tried testing on a part and that worked. Then, I tried putting the NPC and the script in workspace and cloning it and that still didn’t work, and the code outputs no errors.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked through some videos and Developer Forums, and still hasn’t been able to fix the problem.

did you mean

local serverStorage = game:GetService(“ServerStorage”)
local mob = serverStorage:FindFirstChild(“Rig”)


local testFolder = workspace.TestFolder

while true do
	wait()
local clone = mob:Clone()
	clone.Parent = testFolder
	print("cloned character")
end

First of all: I don’t know if this is fully done yet because this is probably not the most efficient way to do whatever you’re doing

Second: To solve your problem, this is what you should do:

local serverStorage = game:GetService(“ServerStorage”)
local mob = serverStorage:FindFirstChild(“Rig”)

local testFolder = workspace.TestFolder

while wait() do
        local clone = mob:Clone()
	clone.Parent = testFolder
	print("cloned character")
end

You only cloned it once so it’s only spawning one.

Thank you, I works now, just for clarification the variable clone has to be under the the while loop so it will be in its scope?

Thank you for your help as well.

You have to clone every individual mob , it doesn’t act as a template

Ok, got it thanks for the clarification.

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