I cam across an error in my code and was wondering if i were to make a localscript on a player and attach a function to game.Players.PlayerRemoving
which triggers when the local player has left, would the script run when they click leave/before they actually leave? or would it just not run since the player isnt there? I know you could make this script work on a server side script but im just curious
This would work both server sided and local sided If you want it in local script do this in StarterPlayerScript Here's and article on PlayerRemoving
script:
game.Players.PlayerRemoving:Connect(function(player) local player = game.Players.LocalPlayer print("A player has left: " .. player.Name) end)