Character removing firing after player removing

I’m trying to get the character’s position and some number values right before the character is removed. When character removing is called, it makes a table of these values and stores them in a dictionary. This works well in studio, but gives me an error in the game. The error I get is the body parts and humanoid not being nil. I tried putting print statements right when player removing and character removing fires, and player removing seems to print first. I found a similar thread to my problem, but all the replies are literally “use character removing”, which doesn’t help me at all.

Showing your code would help, but you can try using Humanoid.Died instead

This is a common problem. Try using Instance.ChildRemoved on the Players service instead of Players.PlayerRemoving. This is because PlayerRemoving fires before CharacterRemoving - and we sometimes don’t want that behavior. So, we use ChildRemoved on Players so the event fires after the character is removed.

PlayerRemoving should fire first if I have my roblox player and character architecture remembered correctly. Maybe you could have a check to make sure the player isn’t leaving the server? You can make it save whatever values you want to save when the player is leaving, and set something for that player so that the CharacterRemoving event knows to just return when it’s fired.

As Thedagz said, showing code is always helpful, and if you cannot show code, giving a detailed explanation of your problem and posting any errors that happen, stack traces are really helpful for us to know what’s going on.