Can't clone a part?

Hi! So, I have a question about something very simple. In replicated storage, I have a part, and I want to clone it. I added print statements and everything, and it prints, but the part is not cloning. I tested the same code with a tool, but that cloned fine. Here is the script:

local part = game.ReplicatedStorage:WaitForChild("Part")

game.Players.PlayerAdded:Connect(function(plr)
          plr.CharacterAdded:Connect(function(char)
                       local clone = part:Clone()
                       clone.Parent = workspace
          end)
end)

If I do this exact same code but specify the variable, “part” as a tool, it works, but it isn’t working on a part for some reason. Does anyone know any solutions? Thank you!

1 Like

Is this a LocalScript or ServerScript? Also, are you absolutely sure that you’ve checked the explorer for the part?

1 Like

It is a server script, and then in-game I searched up the name of the part, and the only one I found was in Replicated Storage. Thanks!

Edit: Forgot to clarify, there are no errors in the output

Where is the server script located? Did you correctly write the name of the part? Maybe try this?

local part = game.ReplicatedStorage:WaitForChild("Part")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		part:Clone().Parent = workspace
	end)
end)

If it doesn’t work, can you try to see if it works after a respawn? It could be that the event has no time to run the first time?

1 Like

Use this code and tell me what it prints:

local part = game.ReplicatedStorage:WaitForChild("Part")

game.Players.PlayerAdded:Connect(function(plr)
          plr.CharacterAdded:Connect(function(char)
                       local clone = part:Clone()
                       clone.Parent = workspace
                       print(clone.Parent,clone.Position,typeof(clone))
          end)
end)

Make sure that the script is located in ServerScriptService.

1 Like

I tried respawning. Also, I mentioned before that there were no errors in the output, so the part name is definitely correct and if it wasn’t, it would give an infinite yield error on the WaitForChild. Also, the script is located in the Server Script Service. Thanks!

It printed: Workspace 6.1500001, 61.8001671, -46.6499977 Instance
Thanks!

Is the part archivable, i’ve made that mistake alot myself.

2 Likes

Yes it is, is that the problem?

Try checking those coordinates in game. It’s probably there, you just can’t see it.

1 Like

Oh no, it looks like I was checking the archivable property of another part, this part seems to be un-archivable, I just changed it, and it works now, thank you so much everyone who tried to help!

1 Like