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

Data Store with strings.

Asked by 10 years ago

Data Store has been the toughest lua topic for me. I have tried many times but it has resulted in failure. I have heard that you could use Data Store with Strings and I have considered on creating a system that when you purchase a in-game hat only in a gui in that game it will save as a string and you will be able to have that hat in other games connected to that main one.

Can someone explain on how to use data store? What I can do with it? What can't I do with it? Examples?

Thank you in advance.

0
Have you already tried the wiki? Pretty straightforward to me. http://wiki.roblox.com/index.php?title=DataStore OniiCh_n 410 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

It is not half bad to do, it is just time consuming and you need to make sure you follow the formula for max requests of (60+10*The number of players). This is an example of a code needed.

game:GetService("DataStoreService"):GetDataStore("MyString"):SetAsync("String","This is an epic string") --Sets the "String" in "MyString"

print(game:GetService("DataStoreService"):GetDataStore("MyString"):GetAsync("String") ) --Gets the "String" in "MyString", prints "This is an epic string"

This can serve for epic data persistence be setting the GetDataStore to the person's name or userId (userId is recommeneded).

0
Thanks! All I needed was some better understanding, the wiki did not give me any info on how to save strings but this helped alot. :) IntellectualBeing 430 — 10y
1
You are welcome. FromLegoUniverse 264 — 10y
Ad

Answer this question