I am trying to get if the localplr in studio has been removed,
basically : when leaving studio,
you would call game.Players.PlayerRemoved()
but that function doesn’t call fast enough.
I am trying to get if the localplr in studio has been removed,
basically : when leaving studio,
you would call game.Players.PlayerRemoved()
but that function doesn’t call fast enough.
game:BindToClose would work I think.
Edit: I saw this was on the client, not on the server.
It doesn’t work.
Then why don’t you list the solutions you have tried in the post body? This is listed in the template of a help and feedback post.
Neither does this function exist, I think you mean game.Players.PlayerRemoving.
I can’t help that much if you give such vague information as “it doesn’t work.”
game:BindToClose() does work.
https://developer.roblox.com/en-us/api-reference/function/DataModel/BindToClose
He is doing this on the client, as stated in the post body.
local Players = game:GetService("Players")
Players.PlayerRemoving:Connect(function(Player)
print(Player.Name)
end)
This works for me (local script).
This works for me too. I already tried doing this earlier.
Oh you don’t get what I mean, I am not running the game, but I found out how to do it.
local Run = game:GetService("RunService")
local Players = game:GetService("Players")
if Run:IsStudio() then
Players.PlayerRemoving:Connect(function(Player)
print(Player.Name)
end)
end
https://developer.roblox.com/en-us/api-reference/function/RunService/IsStudio
Is the way to do it.
It was meant for a Plugin. So that won’t work. That’s why plugin:Unloading() and deactivation.