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

How to use DataStore and leaderstats saving?

Asked by
NorteX_tv 101
5 years ago

Please shorten the info about how to use DataStores for saving all the leaderstats. I tried many things, but for example:

cashValue.Changed:Connect(function()

isn't even recognized. I would, like always, go the easy way and do a stupid, laggy

while 1 do
    Send value to DataStore
    wait()
end

but I'm (and everyone is) limited to only several requests to DataStore per second and I know there are a lot of more efficient way of doing this.

Could someone, in short, and easiest way, do a leaderstats saving and restoring? I know it isn't a request site, so if you don't want to give me the ready to go version, at least explain how that works.

Thanks.

0
You can use the PlayerLeaving event of players to do an easy one time save with SetAsync. Otherwise, if someone were to purchase currency or anything of the sort, you can use UpdateAsync to make sure they won't lose it. SummerEquinox 643 — 5y
0
The wiki pages for GetAsync, SetAsync, and UpdateAsync provide valid examples for usage of each. Also - your changed function isn't working because it doesn't check to see if the changed value is cashValue's Value. SummerEquinox 643 — 5y
0
@SummerEquinox, instead of telling him to visit the almost-useless wiki, give him a valid link, KMinecraftPL, "NoahWillCode" has written a guide for this already : https://scriptinghelpers.org/guides/saving-and-loading-data-with-datastores :] AIphanium 124 — 5y
0
While the wiki sometimes has sub-par documentation - I personally think that GlobalDataStore has relatively well documented endpoints. Noah's article is also good, but calling code examples and documentation useless is naive. SummerEquinox 643 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You'll wanna see this article from developer.roblox.com.

If this doesn't help, comment on this answer and I'll edit it. This official article contains how to handle data saving errors and other stuff.

Ad

Answer this question