I’m trying to make a “theme” Option in my game. That’s why I need the color3 value to save. I know that you can’t directly save a color3 value in datastore so that’s why I need help
– I almost no idea how to work with data stores so don’t mind if the script is bad… I copied it from my cash system so yea😭
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("ColorValue")
local ColorFolder = Instance.new("Folder")
ColorFolder.Name = "ColorFolder"
ColorFolder.Parent = Player
local UpdateEvent = Instance.new("RemoteEvent")
UpdateEvent.Name = "UpdateEvent"
UpdateEvent.Parent = ColorFolder
local Color = Instance.new("Color3Value")
Color.Name = "ColorValue"
Color.Value = Color3.fromRGB(252, 60, 68)
Color.Parent = ColorFolder
UpdateEvent:FireClient(Player) -- Temporary way to test other things out of topic
local Data = DataStore:GetAsync(Player.UserId)
if type(Data) ~= "table" then
Data = nil
if Data then
Color.Value = Data.Color
Color = Player.ColorFolder.ColorValue.Value,
long ago i used this method:
if i want to save a color3, i will covert it to a string that my script can read. for an example rgb 13, 56, 146 turns to
when i want to retrieve the rgb code, i just do:
local code = "13,56,146"
local split = code:split(",")
local rgb = Color3.fromRGB(tonumber(split), tonumber(split), tonumber(split))
(the answer below is a better solution.)
Tbh, just use HexCode, doesnt take as much data as saving a normal RGB Value the way it is, and if you want to convert that into a
Color3.new(1, 0, 0):ToHex() -- ff0000 (Hex Code)
Color3.fromHex("ff0000") -- 255, 0, 0 / 1, 0, 0 (to RGB)
OMG thxxx I’ve never even thought of saving it as hex and that would make most sense as it’s a string value:person_facepalming: And by the way could you help me with this one small error I get? I want a script to change a color3 value but it just does nothing at all
I’m gonna mention that everything in the phone thingy changes color but the value itself doesn’t which is the problem because I need it to change so other parts of the game know what color to change to.
Mention - It Doesn’t throw any errors
Both ColorValue and ColorVal are a color3 value so idk if my knowledge abt this bad or idk so please help if you can.
-- I'm not gonna include all the locals cuz it's a big script blah blah --
local ColorFolder = Player:WaitForChild("ColorFolder")
local ColorValue = ColorFolder:WaitForChild("ColorValue").value
local UpdateEvent = ColorFolder:WaitForChild("UpdateEvent")
for i,v in pairs(ThemePage:GetDescendants()) do
if v:IsA("TextButton") then
wait() -- Giving it time to wait cuz sometimes people like to spam click stuff
ColorValue = v.ColorVal.value -- THIS PART DOESN'T WORK | Color3 value stored inside a button
Pictures to visualize it.