So I have this code that prints out a string format of an RGB color value from a gui frame.
The issue is I need to also take this value and put it into a Color3Value.Value, but I’m not sure how I could go about converting this? I tried tonumber() but it doesn’t work for this case.
local textButton = script.Parent
local player = game.Players.LocalPlayer
local function selectColor()
local chatcolor = player:WaitForChild("chatcolor")
local color = script.Parent.Parent.ColorShower.BackgroundColor3
local r, g, b = color.r, color.g, color.b
local str = string.format("%0.f, %0.f, %0.f", r*255, g*255, b*255)
print(str)
-- I need to somehow take the str and convert it and change the chatcolor.Value with it
end
textButton.Activated:Connect(selectColor)
I tried it but for some weird reason the outputs not in RGB format, and it doesn’t affect the Color3Value.Value?
local function selectColor()
local chatcolor = player:WaitForChild("chatcolor")
local color = script.Parent.Parent.ColorShower.BackgroundColor3
local r, g, b = color.r, color.g, color.b
local str = string.format("%0.f, %0.f, %0.f", r*255, g*255, b*255)
local RGBValues = Color3.fromRGB(table.unpack(string.split(str, ", ")))
chatcolor.Value = RGBValues
print(chatcolor.Value)
end
textButton.Activated:Connect(selectColor)