Skin auto respawning player

Hello, so I’m making a skin system. But the issue is that it’ll auto respawn.

as you can see.
This is my skin loader script

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
	task.wait(1)
		local Inventory = Player:WaitForChild("Inventory")
		local Skins = Inventory:WaitForChild("Skins")
		local SkinValues = Player:WaitForChild("SkinValues")
		for i,v in pairs(SkinValues:GetChildren()) do
			if v.Value == true then
				local SkinInstance = Skins:FindFirstChild(v.Name)
				if SkinInstance then
local SkinInstanceClone = SkinInstance:Clone()
					local Animate = script.Animate:Clone()

					SkinInstanceClone.Name = Player.Name
					
					SkinInstanceClone.Parent = workspace
						
						Player.Character = SkinInstanceClone
					Animate.Parent = SkinInstanceClone
					game.ReplicatedStorage.RemoteEvents.SkinCameraAdjuster:FireClient(Player, SkinInstanceClone)	
					print('char set')				
				end
			end
		end
	end)

	

end)

and my camera adjuster script

game.ReplicatedStorage.RemoteEvents.SkinCameraAdjuster.OnClientEvent:Connect(function(Skin)
	local Camera = workspace.CurrentCamera
	Camera.CameraType = Enum.CameraType.Custom
	local Humanoid:Humanoid = Skin:WaitForChild("Humanoid")
	Camera.CameraSubject = Humanoid
end)

Because changing the character counts as adding the character so the CharacterAdded function keeps firing, you should make it stop working after it’s the new character model.

1 Like

ohh ok i get it. But lets say a player respawns, how would I make the character load in that situation?

You should make an if statement in the CharacterAdded function where the new character model has something to detect that the old one doesn’t.

ok, i’ll try that out real quick thanks for the help