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

Is this possible of put "false" and "true" in a DataStore value?

Asked by 6 years ago
Edited 6 years ago

Is this possible of put "false" and "true" in a DataStore value?

ex:

local DataStoreService = game:GetService('DataStoreService')
local playerData = DataStoreService:GetDataStore('PlayerData')

local sessionData = {}

in my function:

sessionData[player] = {Money = 0, Experience = 0, Weapond = false}
playerData:SetAsync(player.UserId, sessionData[player])

THIS IS JUST A EXEMPLE SCRIPT!
0
If it does not, just use Tostring. Test the script in the actual Roblox game. hiimgoodpack 2009 — 6y
0
This is saving the table? User#5423 17 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago

Hi there!

If you can't store booleans in DataStores, store it as a string. Scripts will interpet it the same [from what i can tell] and if they can't, do the following:

local l = [the "true" or "false]
local m = false -- template

if l == "true" then
local m = true
elseif l == "false" then
local m = false
else
error("what the heck")
end
0
Booleans are compatible with data store, or any process that involves serialization for that matter since they're the most primitive data types. ScriptGuider 5640 — 6y
0
Alright, I wasn't aware. I was just providing a workaround. @ScriptGuider AdministratorReece 193 — 6y
Ad

Answer this question