Im making a script where if you press a button the BoolValue changes to True, but I want to save that value to a Table with datastore, How would I do this? Im doing this because I dont want to have multiple datastores for multiple BoolValues
You insert the boolvalues value into the table
Make a new boolvalue in the leaderstats
local BoolValue = Instance.new("BoolValue")
BoolValue.Name = "BoolValueName"
BoolValue.Parent = leaderstats
and save it the same way you save the other leaderstats intvalues
table.insert(yourtable, true)
or if your using dictionaries
{bool = true}
1 Like
table.insert(table,value)
If you’re using a dictionary, use:
table[Index]=value
Give us more information so give us your leaderstats script so we can see how you are saving the leaderstats
Set a constant name:
local dsName = "My Data Store 1"
Get the data store using DataStoreService
If it doesn’t exist (nil), use :UpdateAsync to set it to a blank table.
Whenever a player clicks button, use RemoteEvent to tell the server that you clicked.
Store true/false values using player UserId as indexes.