Script: https://gyazo.com/74b0f7bf6abec240bba18fa4bc0aa0ee
script.Parent.MouseButton1Click:connect(function() wait(1)
game.StarterGui.ScreenGui2.Frame.TextLabelA1.BackgroundColor3 = Color3.fromRGB(27,45,45)
end)
––––––––– I am trying to use a GUI button to change the BackgroundColor3, yet nothing happens. No errors, nothing. Just doesn't change color.
Example: https://gyazo.com/2e1fb6f8d9e8925145ceb750f80df06d
PLEASE READ ALL OF THIS TO KNOW WHAT'S GOING ON:
First of all:
- StarterGui is just an object to STORE GUIs, when a player joins, the GUIs stored in StarterGui will be replicated to the player, where? in Player.PlayerGui.
- Why the
wait(1)
? I'm not saying it's not okay, it's just that it's unnecessary in this case.- Please use
:Connect()
instead of:connect()
; this one is deprecated.
These are things you need to know when using GUIs:
- You should ONLY do stuff to GUIs using LocalScripts.
- LocalScripts have access to
game.Players.LocalPlayer
, while the regular ones doesn't.
Now, the script you want is this:
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.ScreenGui2.Frame.TextLabelA1.BackgroundColor3 = Color3.fromRGB(27, 45, 45) end)