game.Players.PlayerAdded:connect(function(player) repeat wait()until player.Character local hatId=1045408 if player.Name=="ROBLOX"then hatId=21070012 end local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1] hat.Parent=player.Character end) a=Instance.new("IntValue", game.Workspace) repeat wait() a.Value=a.Value+1 until a.Value==100
repeat wait() print("checking") until game.Players.NumPlayers==1

3 comments
Your code isn't set to fire again when you reset; I recommend using the 'CharacterAdded' event to accomplish this. :)
(I'm bad at scripting) I tried adding this code in the second and third line but it won't work: player.CharacterAdded:connect(function(character) character.Humanoid.hatId=1045408
Can you do me a quick favor and format the code real quick. I think I see the issue and some things you should fix