How to make a character respawn with hats?
can someone help me figure out how to make a player respawn with hats? I got it to where it removes their hats and adds hats to them but idk how to make it so that if they die they spawn with them again
Code:
01 | local Players = game:GetService( "Players" ) |
03 | local function playerAdded(player) |
04 | player.CharacterAppearanceLoaded:Connect( function (character) |
05 | local humanoid = character:WaitForChild( "Humanoid" ) |
08 | humanoid:RemoveAccessories() |
15 | for _, player in pairs (Players:GetPlayers()) do |
19 | Players.PlayerAdded:Connect(playerAdded) |
21 | game.Players.PlayerAdded:connect( function (player) |
22 | repeat wait() until player.Character |
23 | local hatId = 4753644287 |
24 | local hatId 2 = 63650436 |
26 | local hat = game:service( "InsertService" ):LoadAsset(hatId):GetChildren() [ 1 ] |
27 | hat.Parent = player.Character |
29 | local hat = game:service( "InsertService" ):LoadAsset(hatId 2 ):GetChildren() [ 1 ] |
30 | hat.Parent = player.Character |