local last = nil local function turnOrange(new) if last ~= nil then if new.Name ~= last.Name then new.TextColor3 = Color3.new(227, 125, 0) last.TextColor3 = Color3.new(0, 31, 168) end else new.TextColor3 = Color3.new(0, 31, 168) end last = new end for i, v in pairs(script.Parent.Parent:GetChildren()) do if v:IsA("TextButton") and v.Name ~= "Select" then v.MouseButton1Click:connect(function() turnOrange(v) end) end end
soo the script, is completely fine but the color change is off, i want it to chnage orange but it changes yellow, i checked the numbers for orange and i have it correct but it doesnt work also the normal color of the text is dark blue but after i click on it and click another button it turns like teal blue, are there any reasons why this is happening
You basically just need to divide each number by 255 or make a function that does it for you.
local last = nil local function convert_rgb(color) local rgb = {} -- Table to return vals for i in string.gmatch(tostring(color), "%d+") do -- Find the pattern, in this case it's the numbers before each comma. rgb[#rgb+1] = i/255 -- Store the value divided by 255 end return Color3.new(unpack(rgb)) -- return the divided rgb vals. end local function turnOrange(new) if last ~= nil then if new.Name ~= last.Name then new.TextColor3 = convert_rgb(Color3.new(227, 125, 0)) last.TextColor3 = convert_rgb(Color3.new(0, 31, 168)) end else new.TextColor3 = convert_rgb(Color3.new(0, 31, 168)) end last = new end for i, v in pairs(script.Parent.Parent:GetChildren()) do if v:IsA("TextButton") and v.Name ~= "Select" then v.MouseButton1Click:connect(function() turnOrange(v) end) end end