Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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!

2 comments

0

If it does not, just use Tostring. Test the script in the actual Roblox game.

0

This is saving the table?

1 answer

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

2 comments

0

Booleans are compatible with data store, or any process that involves serialization for that matter since they're the most primitive data types.

0

Alright, I wasn't aware. I was just providing a workaround. @ScriptGuider

This discussion is preserved as it was. New answers, comments, and votes are closed.