Hello! I did a character changer system for my game. System uses “CharacterAdded:Connect(function()” and has debounce also stored in ServerScriptService. Everything is fine but theres
a error in Output like
“Something happened while trying to set the parent of Console” and
“The Parent property of 0def0640511e0182a006 is locked, current parent: NULL, new parent PlayerGui”
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
if Player:FindFirstChild("PlayerFolder") and Player.PlayerFolder:FindFirstChild("SelectedSkin") and Player.PlayerFolder.SelectedSkin.Value == "VIP_Skin" then
if not Player.Character:FindFirstChild("BodyRainbowfyClient") then
wait(0.1)
local Old_Character = Player.Character
local VIP_Skin = Packs.VIP.VIP_Skin:Clone()
local VIP_Scripts = Packs.VIP.ScriptFolder
for _, object in pairs(Player.Character:GetChildren()) do
if object:IsA("Script") then
object:Clone().Parent = VIP_Skin
end
if object:IsA("Folder") then
object:Clone().Parent = VIP_Skin
end
end
VIP_Scripts.BodyRainbowfyClient:Clone().Parent = VIP_Skin
VIP_Scripts.BodyRainbowfyServer:Clone().Parent = VIP_Skin
VIP_Scripts.RemoteEvent:Clone().Parent = VIP_Skin
VIP_Skin.Name = Player.Name
VIP_Skin.HumanoidRootPart.Anchored = false
VIP_Skin:SetPrimaryPartCFrame(Old_Character.PrimaryPart.CFrame)
Player.Character = VIP_Skin
VIP_Skin.Parent = workspace
end
end
end)
end)
Probably an unknown loop in a different script? Else don’t bother because you already said nothing happens and it just prints that in the output. If it works don’t bother with lol.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
if Player:FindFirstChild("PlayerFolder") and Player.PlayerFolder:FindFirstChild("SelectedSkin") and Player.PlayerFolder.SelectedSkin.Value == "VIP_Skin" then
if not Player.Character:FindFirstChild("BodyRainbowfyClient") then
wait(0.1)
local Old_Character = Player.Character
local VIP_Skin = Packs.VIP.VIP_Skin:Clone()
local VIP_Scripts = Packs.VIP.ScriptFolder
for _, object in pairs(Player.Character:GetChildren()) do
if object:IsA("Script") then
-- Consider not cloning scripts directly into characters.
elseif object:IsA("Folder") or object:IsA("Model") or object:IsA("Part") or object:IsA("Accessory") then
object:Clone().Parent = VIP_Skin
end
end
-- Instead of cloning scripts directly, consider using RemoteEvents or RemoteFunctions.
-- VIP_Scripts.BodyRainbowfyClient:Clone().Parent = VIP_Skin
-- VIP_Scripts.BodyRainbowfyServer:Clone().Parent = VIP_Skin
-- VIP_Scripts.RemoteEvent:Clone().Parent = VIP_Skin
VIP_Skin.Name = Player.Name
VIP_Skin.HumanoidRootPart.Anchored = false
VIP_Skin:SetPrimaryPartCFrame(Old_Character.PrimaryPart.CFrame)
local success, message = pcall(function()
Player.Character = VIP_Skin
VIP_Skin.Parent = workspace
end)
if not success then
print("Error occurred during operation: " .. message)
end
end
end
end)
end)
did you download any plugins or got anthing from the toolbox?
because that error maybe on a plugin or something. maybe because some script are trying to change the parent of the console and it said the parent of the console is locked