The current PlayerRemoving is very useless to me because the player’s parent is still Players so without passing auxiliary information to a function/creating a new function specifically for PlayerRemoving/doing a lot of hacks, it is impossible to know from within the function if the player has left the game
Right now I will be using ChildRemoved instead (which fires only after the parent property has been set to nil), but it would be nice if there were a PlayerRemoved event because up until now I have been struggling with PlayerRemoving, and I assume many others have been too due to the implied superiority it gets from its name
I would want PlayerRemoved to function exactly like ChildRemoved, but only get called for Player Instances
The specific use case that sparked me to write this feature request is a pre-saving callback that relies on in game data which also needs to be deleted on player leave (to prevent a memory leak)
I used to [think I was, this rbx bug actually prevented it] erase the data on PlayerRemoving but that created a race condition between if the temporary data would be accessed by the pre-saving callback and if it would be cleared
This is what I can easily do now by using ChildRemoved (notice the very simple if not plr.Parent
check)
_G.stats.base.saving:bind(function(plr,data)
for k,v in next,data do data[k]=nil end
local base=bases[plr]
for k,v in next,base do
if typeof(k)=='Instance'and type(v)=='table'then
data[#data+1]=v
end
end
if not plr.Parent then
for i=1,#workspace.plates:GetChildren()do
if plates[i]==plr then
plates(i,nil)
break
end
end
base:kill()
base.elevator:Destroy()
base.plate:ClearAllChildren()
for k,v in next,base do
if typeof(k)=='Instance'and type(v)=='table'then
k:destroy()
end
end
bases[plr]=nil
end
end)
So if PlayerRemoved were implemented, I think more people would use it over PlayerRemoving because it would sound just as reputable, or is everyone already using ChildRemoved and am I just clueless?
To clarify again, this is not asking for a rename like this feature request, but instead is asking for a new method
Also it would be nice if DescendantRemoved were added for the exact same reasons