When I equip the tool, the gui pops up and there are text buttons. When I click the text buttons, I want to change the color to red if its green and green if its red, but when I click it the button says " r cannot be assigned to" and that's it.
script.Parent.TextButtona.MouseButton1Click:connect(function() if debouncea == false then debouncea = true a.BackgroundColor3.r = (170) a.BackgroundColor3.g = (16) a.BackgroundColor3.b = (19) elseif debouncea == true then debouncea = false c.BackgroundColor3.r = (25) c.BackgroundColor3.g = (170) c.BackgroundColor3.b = (15) end end)
You need to access the Player's GUI, not the game's.
Local Script inside of the tool:
script.Parent.Equipped:connect(function() game.Players.LocalPlayer.PlayerGui["Security Tablet"].Frame.Visible = true end) script.Parent.Unequipped:connect(function() game.Players.LocalPlayer.PlayerGui["Security Tablet"].Frame.Visible = false end)