So I just tried to make a activate/deactivate button with changing their color (white if deactivated, red if activated). My code:
local Button = Instance.new("TextButton")
local ButtonActivated = false
local ActivatedColor = Color3.fromRGB(170, 0, 0)
local DefaultColor = Color3.fromRGB(255, 255, 255)
Button.MouseButton1Click:Connect(function()
if buttonActivated == false then
Button.BackgroundColor3 = ActivatedColor
else
Button.BackgroundColor3 = DefaultColor
end
if ButtonActivated == false then
-- Activating...
else
-- Deactivating...
end
end)
And it gives the following error:
Players.Hello1502HD.PlayerGui.Script:8: attempt to index function with 'BackgroundColor3'
I can't understand that.
Thx for reading and maybe helping! :)

1 comment
Are you sure Fly is a GuiObject and not a function?