My "theme" button is an ImageLabel, and whenever it's clicked it changes to a sun or moon icon depending on the theme. i.e If light mode is on, it will be a sun icon, and if dark mode is on, it will be a moon icon. It works fine except the button becomes the color of the background. I'm not sure why it's doing this.
local gui = script.Parent
local container = gui["Text Container"]
local play = container.Play
local theme = container.Theme
local ThemeType = 1
theme.MouseButton1Down:Connect(function()
if ThemeType == 1 then
play.TextColor3 = Color3.fromRGB(255,255,255)
theme.ImageColor3 = Color3.fromRGB(255,255,255)
container.BackgroundColor3 = Color3.fromRGB(0,0,0)
theme.Image = "https://web.roblox.com/library/4452368920"
ThemeType = 2
elseif ThemeType == 2 then
play.TextColor3 = Color3.fromRGB(0,0,0)
theme.ImageColor3 = Color3.fromRGB(0,0,0)
container.BackgroundColor3 = Color3.fromRGB(255,255,255)
theme.Image = "https://web.roblox.com/library/4452366936"
ThemeType = 1
end
end)
play.MouseButton1Down:Connect(function()
play:Destroy()
theme:Destroy()
end)
