Now I have tried doing this and it is part of a data storage. However, I have no idea how to get player position when they leave. Here is what I tried:
game.Players.PlayerRemoving:Connect(function(player)
game.Players:FindFirstChild(player.Name).Location.X.Value = game.Workspace:FindFirstChild(player.Name).HumanoidRootPart.Position.X
game.Players:FindFirstChild(player.Name).Location.Y.Value = game.Workspace:FindFirstChild(player.Name).HumanoidRootPart.Position.Y
game.Players:FindFirstChild(player.Name).Location.Z.Value = game.Workspace:FindFirstChild(player.Name).HumanoidRootPart.Position.Z
end)
These are coordinates for the player when they leave which I hoped would get their location when they leave. Obviously, it does not work. How would I do this?

2 comments
I dont think you can't use a characterremoving function for PlayerAdded
@RjsMc You can actually; it fires right when the player leaves, however this code should check to differentiate a player respawn from a player removal, as CharcterRemoving will fire if the player resets their character as well.