0k_Jackk
(Jack)
September 16, 2023, 3:42am
#1
Hello, How could I save a table of boolean values to data stores? I have this default table of items the player owns and I want to be able to easily set the value to true when they unlock something and save it.
local Default = {
["Basic"] = true;
["Fall"] = false;
["Stellar"] = false;
}
4 Likes
Is this the whole script for the datastore the table belongs too?
1 Like
0k_Jackk
(Jack)
September 16, 2023, 4:15am
#3
I’m not entirely sure what you mean but the table is in the same script as the datastore yeah.
1 Like
sussy_bacoo
(sussy_bacoo)
September 16, 2023, 4:16am
#4
maybe module scripts? those are good for tables
1 Like
I am meaning is the table all you have in the script? Do you have a datastore set up with it?
0k_Jackk
(Jack)
September 16, 2023, 4:18am
#6
Yeah it is the table but its only meant to set the values for when someone joins for the first time without any data and I do not have data stores set up for it yet.
so u need help with saving the table into the player’s folder?
1 Like
Ok try this to save the data.
From this how would I put it into a DataStore?
local Players = game:GetService('Players')
local DSS = game:GetService('DataStoreService')
local VehicleStorage = DSS:GetDataStore("VehicleDatabase")
local data = {
strings = {}
}
local vehicle = "Vehicle 1"
game.Players.PlayerAdded:Connect(function(player)
local response
local success,errormessage = pcall(function()
response = VehicleStorage:GetAsync(player.UserId)
end)
if success then
if response then
print("Found Data: "..table.c…
To set boolean value to true do something like this
Example:
player.Folder.Basic.Value = true
4 Likes
Claym1x
(Emma)
September 16, 2023, 5:07am
#9
I suggest using a list, where you can iterate or try to find the item you are looking for. This works better for data usage as you are not storing as much. Lists/tables should be able to work fine with datastores
Has my solution/reply help/solved you problem? Or do u need more help? Please let me know.
0k_Jackk
(Jack)
September 23, 2023, 10:45am
#11
Yeah super sorry about that I thought I had marked it as a solution, my bad. Thank you for your help.
1 Like
No worries and no problem
This text will be blurred
system
(system)
Closed
October 7, 2023, 11:24pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.