What do you want to achieve?
How to know if the local player join/leave a game ?
What is the issue?
I don’t know if the local player join/leave a game.
What solutions have you tried so far?
I’ve tried this but that doesn’t work (when the player die that print leave) :
local Player = game.Players.LocalPlayer
Player.CharacterAdded:Connect(function()
print("Join")
end)
Player.CharacterRemoving:Connect(function()
print("Leave")
end)
That’s because you used CharacterAdded and CharacterRemoving instead of PlayerAdded and PlayerRemoving, the character gets removed and added back on respawn/death
The thing is You cannot check does local player join / leave.
When player joins all the local scripts begin to function and when the local player leave, all the local scripts get deleted.
As because all of the processes take place on client-side then it’s basically impossible.
local Players = game.Players
local Player = game.Players.LocalPlayer
print("join")
Players.PlayerRemoving:Connect(function()
Player.CharacterRemoving:Connect(function()
print("Leave")
end)
end)
Also - CharacterAdded and CharacterRemoving launches everytime player respawn. Thats because character get removed and added back once again but alive (after character death)