[BUG] - Dark Mode Same Colors

What i’m trying to do is to make Theme

Here’s what code i do so far!

-- Variables :

local Replicated = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Theme = Replicated.Theme

script.Parent.MouseButton1Click:Connect(function()

	if Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1003 then
		script.Parent.Text = "DARK"
		Theme.Dark:FireServer()
		
		-- Set Colors
		
		script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(111, 111, 111)
		
	elseif Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1002 then

		script.Parent.Text = "LIGHT"
		Theme.Light:FireServer()
		-- Set Colors
		
		script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(1, 1, 1)
	
	end

end)

-- Loading process

wait(10)
	if Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1002 then
	script.Parent.Text = "DARK"
	
	script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(111, 111, 111)
	
	elseif Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1003 then
	script.Parent.Text = "LIGHT"
	
	script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(1, 1, 1)
	
	end

-- When the value changed

Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Changed:Connect(function()
	if Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1003 then
		script.Parent.Text = "LIGHT"
		-- Set Colors

		script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(1, 1, 1)
	elseif Players.LocalPlayer:WaitForChild("ThemeStats").Theme.Value == 1002 then
		script.Parent.Text = "DARK"
		
		-- Set Colors

		script.Parent.Parent.Parent.Codes.BackgroundColor = BrickColor.new(111, 111, 111)
	end
end)

At first it really loads the right color however when i click it doesnt change to right color even the RGB code is right and Value is right?

Instead of using BrickColor.new(), use Color3.fromRGB() when working with Gui Objects

hehe