Cloning Every Child Of An Object

I am trying to clone a part however I need everything in the part to be cloned as well. When I clone the part (from replicated storage) it comes out as only the part. Is there any way to clone an object and everything in it?

Thanks in advance,
WolfTamer894

2 Likes
local folder = workspace:WaitForChild("Folder")

for i, v in pairs(folder) do
	local clone = v:Clone()
	clone.Parent = workspace
end
1 Like

When you clone an instance with children/descendants those will be cloned inside of the instance too.

1 Like

Here is my code:

        local CoinClone1 = game.ReplicatedStorage.Coin:Clone()
	local CoinClone2 = game.ReplicatedStorage.Coin:Clone()
	local CoinClone3 = game.ReplicatedStorage.Coin:Clone()
	
	CoinClone1.Parent = game.Workspace
	CoinClone2.Parent = game.Workspace
	CoinClone3.Parent = game.Workspace
	
	CoinClone1.Name = "CoinClone1"
	CoinClone2.Name = "CoinClone2"
	CoinClone3.Name = "CoinClone3"

However it is not cloning every child of the part.

1 Like

Can you show what is inside the coins with a screenshot?

1 Like

Here it is! It may be a team create issue.

Temp

2 Likes
local storage = game:GetService("ReplicatedStorage")
local coin = storage:WaitForChild("Coin")

local coinClone = coin:Clone()
coinClone.Name = "CoinClone"
coinClone.Parent = workspace

Try this.

4 Likes

That worked! Did I need to reference the Replicated Storage as a service, is that why is wasn’t working?

1 Like
storage:WaitForChild("Coin")

WaitForChild waits for the child to fully load before attempting to do anything with it. The way you referenced ReplicatedStorage was fine.

2 Likes

Oh, okay. Thanks again!

WolfTamer894

1 Like