How can I hide players from leaderboard + esc menu lists?

This game has a mechanic where if you die, you’re removed from both the leaderboard and the Esc menu together as if you’re not on the server, however, you are still present and other players just can’t see you. You are able to turn into a ghost and interact with the world regularly, but you’re still invisible to either player list. How would I replicate something like this?

you can delete the player on the client. like i mean(local script) game.Players.PlayerHere:Destroy()

game.Players.PLRNAME.Parent = nil