My issue is with using GetPropertyChangeSignal(“Parent”) to wait for the player’s parent to be changed. (when the player is removed)
Issue:
I have one script which uses a PlayerAdded event and waits for the player’s parent to be changed. (so it can disconnect a .Chatted event)
I also have another script which uses a PlayerAdded event and waits for the player’s parent to be changed and then will disconnect a .Chatted Event
How I wait for the parent to be changed:
player:GetPropertyChangedSignal(“Parent”):Wait()
However, with the first script, it will automatically resume despite the parent not being changed. This doesn’t happen in the second script.
I’ve made a workaround, but i’m still curious why it resumes even though the parent wasn’t changed, and also why it doesn’t also happen in the second script even though I use the same mechanism.
Then I would have to make a table, store the connections in the table, and then when the player leaves, disconnect all the connections, along with removing the connection from the table. Simply waiting for the parent to be changed is simpler. Also, i’m probably going to stick with my work around, considering it factors in if they player has already left. (it yields before the connection is established, so using player removing might make it so some of the events aren’t disconnected, although only if they leave almost immediately)
My work around:
wait()
local h = not player.Parent or player:GetPropertyChangedSignal(“Parent”):Wait()