What do you want to achieve?
I want to clone every object inside of my character in a for a loop, but nothing is cloning inside of the model.
What is the issue?
Nothing is cloning at all. Actually, the for loop isn’t even running! Especially weird since this code was working before. Here’s a pic.
There is nothing in the output
Here’s the code:
Client:
--Cloned Character
char.Archivable = true
local cloned_char = char:Clone()
cloned_char.Name = "Clone"
cloned_char.Parent = viewport
-- >>: Clone everything in the character
for i, v in pairs(char:GetChildren()) do
print("Start")
local item = v:Clone()
item.Parent = cloned_char
if item.Name == "Humanoid" then
local Human = item
Human.DisplayName = " "
end
if item.Name == "HumanoidRootPart" then
local HRP = item
cloned_char.PrimaryPart = HRP
end
end
This is not the entire script
What solutions have you tried so far?
Switching it to elseif to see if something would happen
The reason the for loop is seemingly not doing anything is because you’re instantly trying to iterate over the character’s children, which take a very small amount of time to be added. You need at the very least add something like a RunService.Heartbeat:Wait() before the loop and it should work as intended.