Having a problem with Player accessory

Hello so, basically, I am making a custom character creation, but when the player dies accessory get’s removed, and I am using a Player.CharacterRemoving event to save everything when player leaves or die, basically, when player dies Accessory get’s removed, there’s anyway to prevent this? I already use BreakJointsOnDeath but still, I am using Adonis and when I use :re or :kill doens’t works.

1 Like

The character is not preserved when respawning, so as such when your character dies the accessories won’t remain if you don’t have any code that automatically adds them back.

You can use the Player.CharacterAdded event to detect when a character has loaded (or, alternatively, Player.CharacterAppearanceLoaded if you want to wait until all assets within the character have loaded), then simply create the accessories again.

As an example:

local function handleCharacter(char)
	-- runs every time the character spawns/respawns
	-- implement code that loads accessories for the player here
end

game:GetService("Players").PlayerAdded:connect(function (player)
	player.CharacterAdded:connect(handleCharacter)
	if player.Character then
		handleCharacter(player.Character)
	end
end)
3 Likes