Error when Changing Player Character

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”

Screenshot of error:

Video of error:

Code:

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)

How can i fix this error?

i dont know if it will work but the main thing of the character is these thing:
image
Body Colors,
Pants,
and Shirts.

You can also remove/add accesories
and you can also change the material of the character to plastic or the material you like.

Good but some rigs has extra parts than normal Character limbs. And it will take too much script lines to set parts.

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.

1 Like

i think the problem is that, idk
check the VIP_Skin Parent if the locked property of it is set to true.

Can i see the explorer? or the workspace

screenshot

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)


still giving the same error

“51b38a418b8ae48817bc”, hmm

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