How do I change the background color of a gui when a player clicked it?
Depends on how you want it done.
This is the controlled version:
ColorOne = 1, 0, 0 ColorTwo = 0, 1, 0 ColorThree = 0, 0, 1 script.Parent.MouseButton1Down:connect(function() if script.Parent.BackgroundColor == ColorOne then script.Parent.BackgroundColor = Color3.new(ColorTwo) elseif script.Parent.BackgroundColor == ColorTwo then script.Parent.BackgroundColor = Color3.new(ColorThree) else script.Parent.BackgroundColor = Color3.new(ColorOne) end)
You could do a more complex one with math.random.
You must put this in a TextButton
This code will change the color of the TextButton when clicked!
----- color = "Black" -- put color you want here ----- sp=script.Parent function click() sp.BackgroundColor3 = BrickColor.new(color).Color end