Sometimes check and load doesn't work the first time?

So I have this script that checks if the player joined, when the character is loaded, and if they have a stat. but sometimes when the player first joins, this doesn’t run or doesn’t load properly, any help? Keep in mind its not like its just this 1 in general, its all of them. So if I can find a fix for this one, I can fix them all.

	game.Players.PlayerAdded:connect(function(player)
		player.CharacterAppearanceLoaded:Connect(function(character)
		if player:WaitForChild("leaderstats"):WaitForChild("Hats").Value == 1 then
1 Like

Sometimes if you play solo and you have the :Connect later on in the script it would connect to the event after you’ve joined since in play solo you join quickly. Just move it to the top. Or is it already at the top?