What are the DataStore Basics

what are the basics for datastore including all the values and tables

1 Like

:GetAsync(key) -- gets value of key ex. :GetAsync(plr.UserId.."cash") would be the players cash and

:SetAsync(key, value) -- sets the value to the key. :SetAsync(plr.UserId.."cash", 10)
1 Like

whats the rest ? because im wanting to make a datastore for admins

1 Like

make sure to read this page from start to end without skipping anything

3 Likes

Also worth noting that this article does not explain DataModel:BindToClose() and a good data system should use it.

Save player data when the game starts to shut down, where each save is wrapped under an individual thread (because you cannot delay your game shutting down) to ensure the safest data.

See here to read about this practice.

2 Likes

I guess so

while bindtoclose has nothing to do with datastore its useful for saving data when the server is shutting down

Mainly for saving player data because when the last player exits the game the server will Instantly start shutting down not giving enough time to save the lasts players data

And that’s where bindtoclose allows you keep the server running for a extra 30 seconds giving you enoth time to save the last players data

It shouldn’t be active for anywhere near 30 seconds. Once the game instance has completed all of its tasks including saving, it should immediately be closed.

I only mention this practice because OP is asking what the basics of DataStore are- and this is one.

If you want to understand something, you should search it up on the dev hub before asking here.

https://developer.roblox.com/en-us