#💬 foodʹs Feedback
1 messages · Page 1 of 1 (latest)
fedbac
why did you do one table at the top and one in the player ufnctoin?
casing is inconsistent
avoid scopes
instead of this
do this
if not success or not data then
return
end
DATA.Value = data.Dta```
naming conventions also a little convusing
data
DATA
dta
Yeah
This is code that i was gonna put into finished creations bout two months ago
Then forgot
Soo
Here i am
for your final saving, you are going to want to save every player's data on game:BindToClose()
in these cases, the PlayerRemoving event is never (or almost never) fired:
- The last player leaves the game
- The developer shuts down the game
- The server has an issue and needs to shut down
also note that after the bindtoclose event is fired, you have 30 seconds to execute any code before Roblox fully kills the server. this may sound like alot, but if you have 30 players in your server and are making long datastore calls, it is possible to achieve this limit. for that reason, you should run per player datasaving code async.
so something like this would probably be ideal:
game:BindToClose(function()
for _, v in ipairs(Players:GetPlayers()) do
task.spawn(saveData)
end
end)
Huh