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

Is PlayerRemoving event good when using DataStore?

So I'm trying to make a script that saves a players points when they leave. I basically wants the points to get updated everytime they leave by using PlayerRemoving. So i was wondering if PlayerRemoving is good? or is it any better options?

ty!

1 answer

✓ Accepted answer

YESSS!. Whenever your handling datastores its best to use them everytime they enter and leave your game. Using playeradded is good for when a player is joining your game so you can load heir data, and playerremoving is great for saving data as they leave your game.

2 comments

1

However if the player is leaving the game, it is recommended you add the game.OnClose = function() wait(30) end to make sure that last player leaving, gets their Data saved. Otherwise the YieldFunction may take too long and the server would shutdown during the saving process.

0

^^ What he said.

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