Will this cause a memory leak?

I create an IntValue on PlayerAdded on the server, which is destroyed when player is removed. I call Changed:Wait on it but what if the the player leaves before it is changed? Will the :Wait cause a memory leak?

Not sure. Have you tested it yet?

It leaks the thread yes. The thread waits indefinitely. For this reason just :Connect to the Changed event.

1 Like

This would do the same exact thing as having a server-sided remote function trying to get a value from a specific client, but the player leaves before a value is sent, so be careful of that too for whatever it is you’re trying to do.