Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to stop player from leaving before save occurs?

I have a script and the problem is that a player leaves before it finishes saving and so everything is returned nil because it can't find the player. I used BindToClose which I'm pretty sure is keeping the server from shutting down while saving, my plr variable are returning nil because the player has left already. Can someone point me in the right direction. Thx in Advance.

8 comments

0

no code?

0

No reason for code. i just need to know a method or module for doing this

0

Are you... unsatisfied. lol

0

yes

0

use a PlayerRemoving event. It will save before the player leaves.

0

Be back 2:50 CST

0

I've been using PlayerRemoving

1 answer

Since no content was provided, I'll provide you with a simple fix.

game.Players.PlayerRemoving:Connect(function(Player)
    -- Save Data here
end)

This event is fired when the player leaves. Just save data when they leave, this should fix your problem.

Hopefully this helped!

Best of luck developer!

BlackOrange3343

This discussion is preserved as it was. New answers, comments, and votes are closed.