I have a server script in server script service which clones everything under the script:
However nothing is actually being cloned and no errors are given in the console and the game is R15, here is the code:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
for i,v in pairs(script:GetChildren()) do
local interaction = v:Clone()
interaction.Parent = character:WaitForChild("UpperTorso")
if interaction.Name == "Main" then
interaction.Disabled = false
end
end
end)
end)
If that doesn’t work (which it probably won’t), then replace all of the code with this and tell me which part doesn’t print (if one of them doesn’t)
game.Players.PlayerAdded:Connect(function(player)
print("a")
player.CharacterAdded:Connect(function(character)
print("b")
for i,v in pairs(script:GetChildren()) do
print(i.." "..v.Name)
local interaction = v:Clone()
interaction.Parent = character:WaitForChild("HumanoidRootPart")
print("c")
if interaction.Name == "Main" then
interaction.Disabled = false
print("d")
end
end
end)
end)
print("e")
So I’m assuming they still didn’t clone, which might be why it’s not finishing the entire thing, but that wouldn’t make sense since it prints “d” AFTER it enables the script.
end
print("e")
end
print("f")
end)
print("g")
end)
print("h")
Replace the “ends” in your code with these.
I’m kinda confused since everything should be working.
I added the new print statemented and even added 2 statements to print:
local interaction = v:Clone()
interaction.Parent = character:WaitForChild("UpperTorso")
print(interaction.Parent)
print(interaction.Parent.Parent)
print("c")
Both the parent and parent.parent print as usual with the results being UpperTorso and NonStopEA8 (my character name), however once I’m in live explorer, none of the cloned instances can be found.
before running your loop trying a while or repeat loop until the part you wish to clone the items into are loaded, it could be possible that you’re waitforchild gives up on waiting for the object to spawn and not clone it into the torso
There are times I need to clone properties and parts of the player’s character occasionally, but that’s about the only time I’ve ever used it so far. (but that’s just a matter of disabling it so I can clone the data lol)
I’ve had friends do that in one of my group projects before, but it wasn’t me. I can’t think of a single time I’d ever use it in the games I make
Okay. I’m finally home now. Sorry I took so long
Do you mind sending me a place file so I can look at the game myself? Just makes it easier to help. You can send it via private message if you don’t want to publicly.
If not either way, it’s okay. I’ll still try my best to help!
Thank you to everyone that helped, I managed to solve the problem by going through my other scripts and tracked it down to a script that forced the player to wear the blocky package (which I’m guessing reset the torso after everything had been cloned inside) but once again, thank you to those who attempted to help, it was greatly appreciated.