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

How do I get back data from the DataStore?

I can send Data to the data store, but how do I get the data back?

2 comments

0

Explain your issue more, this is a broad topic and have not explained any more than in the last post I locked of yours. What exactly are you trying to do? What have you tried? Did you read the wiki at all? It will tell you GetAsync will get you DataStore value.

0

I tried getting Async, it simply does not work in terms of getting data. I can even show you code for it.

1 answer

✓ Accepted answer

That's easy to do using the :GetAsync(key) method. You can save it in a variable or instantly use it, whatever you wish. Just take a look at this:

ds=game:GetService("DataStoreService")
local data=ds:GetAsync("key")
game.Players.PlayerAdded:connect(function(plr)
	plr:WaitForChild("Character").Name=data
end)

This as example, would theoretically change the name of an added player's character. It needs the key used for :SetAsync(key, data) and obviously set data! It will return nil if there is no data, so be sure to prepare your code for this. Hope this helps! If you got any other questions, feel free to ask.

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