Play a sound when the player leaves

Hey everyone,

I have been interested in making it so that when the player leaves the game, a sound is played (preferably for only the player, but it doesn’t really matter in my case whether it’s local or server).

I have been searching multiple other forums in search of answers, as my code never seemed to work. Apparently this block of code created by another user on a similar forum is supposed to work, but It does not seem to work in my case:

this forum is only from a few months ago, so I don’t understand how this is not working.

Am I overseeing something? Is the code already outdated? Any answers would be greatly appreciated. Thanks!

1 Like

You better show more information for better advices.
Show your script, and try print()

Use playerRemoving instead, game.OnClose is only for server shutdowns.

And game.OnClose is deprecated, you can use BindToClose instead

2 Likes

Update:

After some digging, it seems that this ability was patched by Roblox a few months ago and is apparently no longer possible.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.