DataStore Saving With Color on Value Not work

Here
Saved data

	BoothColor:SetAsync(player.UserId, player.SystemData.CBooth.Value)

Player Joined Get Color Value

local CuzColor = script.CBooth:Clone()
	CuzColor.Parent = Data
	CuzColor.Value = BoothColor:GetAsync(player.UserId) or Color3.new(0,0,0)

DataStore

local BoothColor = DataStore:GetDataStore("SureVBooth")

any solve?

2 Likes

I recommend serializing colors to Hex code before trying to save them, so that it’s stored in ascii characters. You can convert with something like this
Color3 ToHex

Color3 FromHex

-- Assuming CBooth is a Color3Value
local boothColor = player.SystemData.CBooth.Value
local boothColorHex = boothColor:ToHex()
myDataStore:UpdateAsync(someKey, function(oldvalue)
    local newValue = oldValue or {}
    -- Use boothColorHex as the color value saved here
    newValue.BoothColor = boothColorHex
end)

-- later, when loading:
local data = myDataStore:GetAsync(someKey)
local boothColorHex = data.BoothColor
local boothColor = Color3.fromHex(boothColorHex)
player.SystemData.CBooth.Value = boothColor
1 Like

I dont know this :frowning:
you can send me it

this or just save a table of each r g b value instead

i using ColorValue
image

Simply use ColorValue:ToHex() to convert them to hex and retrieve them using Color3.fromHex()

You can’t store Color3 Values in data stores, so you will have to convert it into a Hex Value first. Like @BusyCityGuy said.

Here you can do it like this:

Color3.fromRGB(255,255,255):ToHex() -- Will return Hex code for white

Hmmmm i dont know it u can tell me script wanna Full script?

Just use DataStore:SetSync() but instead of the value, convert it to a hex with my method.

Not that hard to do.

i so think hard it
ertfgreghrtghbytg

BoothColor:SetAsync(player.UserId, Color3.new(player.SystemData.CBooth.Value):ToHex())

should be something like that.

Next GetSync?
wofergmjrfigjkntfgbhtf

Uhhh, yeah, use DataStore:GetSync() to get the data ig, this is just basic data store knowledge.

As @JAcoboiskaka1121 stated you should use :ToHex() when converting them. You should also consider using Profile store which is a great datastore module, your script is fine but you should wrap GetAsync / SetAsync on pcall for catching errors. You should also keep everything inside one key because this can overload datastores, your script with hex:

local Text = "Write Your Text"
local DataText = "TextData"
local DataFonts = "FontsData"
local DataBooth = "BoothData"
local DataStore = game:GetService("DataStoreService")
local TextDS = DataStore:GetDataStore("TextDataSaved2")
local FontsDS = DataStore:GetDataStore("FontsDataSaved")
local BoothDS = DataStore:GetDataStore("BoothDataSaved2")
local HATCHEDDATA = DataStore:GetDataStore("HatchedData26")
local BoothColor = DataStore:GetDataStore("SureVBooth")
local newplayer = true
--Don't worry about the rest of the code, except for line 25.
game.Players.PlayerAdded:connect(function(player)
    local Data = Instance.new("Folder",player)
    Data.Name = "SystemData"
    local CuzTextNew = Instance.new("StringValue",Data)
    CuzTextNew.Name = DataText
    CuzTextNew.Value = TextDS:GetAsync(player.UserId) or Text
    local CuzText = Instance.new("IntValue",Data)
    CuzText.Name = DataFonts
    local CuzColor = script.CBooth:Clone()
    CuzColor.Parent = Data
    local defaultBoothColor = Color3.new(0,0,0)
    local success, boothColor = pcall(function()
        return BoothColor:GetAsync(player.UserId)
    end)
    if success and BoothColor then
        defaultBoothColor = Color3.fromHex(boothColor)
    end
    CuzColor.Value = defaultBoothColor
    CuzText.Value = FontsDS:GetAsync(player.UserId) or 12187376174
    local CuzTextT = Instance.new("StringValue",Data)
    CuzTextT.Name = DataBooth
    CuzTextT.Value = BoothDS:GetAsync(player.UserId) or "Default"
    local hatchedbool = Instance.new("BoolValue",Data)
    hatchedbool.Name = "Hatched"
    hatchedbool.Value = HATCHEDDATA:GetAsync(player.UserId) or newplayer
    ------

end)


game.Players.PlayerRemoving:connect(function(player)
    HATCHEDDATA:SetAsync(player.UserId, player.SystemData.Hatched.Value)
    TextDS:SetAsync(player.UserId, player.SystemData.TextData.Value)
    FontsDS:SetAsync(player.UserId, player.SystemData.FontsData.Value)
    BoothDS:SetAsync(player.UserId, player.SystemData.BoothData.Value)
    BoothColor:SetAsync(player.UserId, player.SystemData.CBooth.Value:ToHex())
end)
1 Like

i try it now!
eewrfregwasdweger

Not working
here video
Sorry Its max MB

Could you please provide a screenshot of the output?

image

Hmm, my bad. You should change it to this instead:

BoothColor:SetAsync(player.UserId, player.SystemData.CBooth.Value:ToHex())
1 Like

Not work
Not showing Output
dd