Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is PlayerRemoving event good when using DataStore?

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

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. M39a9am3R 3210 — 8y
0
^^ What he said. koolkid8099 705 — 8y
Ad

Answer this question