Hello developers. I was scripting a for loop to clone an entire table. It worked, but then I moved it to a serverscript. When I moved it to the serverscript, it stopped working.
Here is the script:
local playerColorsFolder = Instance.new("Folder",player)
playerColorsFolder.Name = "PlayerColors"
for i,color in pairs(game:GetService("ReplicatedStorage"):GetChildren()) do
if color.ClassName == "Color3Value" then
print("yes") -- yes it prints yes the amount of times needed
local playerColor = color:Clone()
playerColor.Parent = playerColors
playerColor.Name = color.Name
end
end
try adding prints throughout the script so we can narrow in on the line of code that’s not working
local playerColorsFolder = Instance.new("Folder",player)
print("Test")
playerColorsFolder.Name = "PlayerColors"
print("Test1")
for i,color in pairs(game:GetService("ReplicatedStorage"):GetChildren()) do
print("Test2")
if color.ClassName == "Color3Value" then
print("yes") -- yes it prints yes the amount of times needed
local playerColor = color:Clone()
print("Test4")
playerColor.Parent = playerColors
print("Test5")
playerColor.Name = color.Name
end
end