I probably know the answer already, but why doesn't datastore save a string value?
ROBLOX String Value Datastore?
1 answer
Data store can save all values that can be interpreted by another language. This includes strings, bools, numbers, and tables. Let's try going over this step by step:
Getting data store service
local DataStoreService = game:GetService'DataStoreService'
Creating a new data store
So, data store gives us the neat option to basically create a table we can save data to. We can create such a table with using the "GetDataStore" method on the data store service, like so:
local DataStoreService = game:GetService'DataStoreService'
local MyData = DataStoreService:GetDataStore'Testing'
If "Testing" already exists, it will retrieve all data from that table. If not, it will create a new one that we can configure.
Saving data
We can save data to this newly created table, using "SetAsync" and "UpdateAsync". Let's try an example of SetAsync:
-- Data stuff
local DataStoreService = game:GetService'DataStoreService'
local MyData = DataStoreService:GetDataStore'Testing'
-- New data
MyData:SetAsync("Key1" , "Hello world")
In the example above, we set "Key1" to the value of "Hello world". In Lua understanding, we can basically say it looks like this:
local DataStoreService = {
['MyData'] = {
['Key1'] = 'Hello world'
}
}
Now, don't take this literally, but this can be a very clear way to look at it and understand it.
Getting data
Let's test our example by printing the data we saved with "print" and "GetAsync"
-- Data stuff
local DataStoreService = game:GetService'DataStoreService'
local MyData = DataStoreService:GetDataStore'Testing'
-- New data
MyData:SetAsync("Key1" , "Hello world")
-- Print results
print(MyData:GetAsync("Key1")) -- > "Hello world"
Let me know if you have any questions.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
It does... DataStore:SetAsync(string key, variant value)