Chaning Colour in a GUI via script doesn;t work

Im trying to change the colour of a frame created in an, but when I try to change the frame backgroundcolour3 it wont work, what could be wrong?

local Players = game:GetService("Players")
local players = Players.LocalPlayer
local SG ="ScreenGui")
local Initiate ="TextLabel")

local OpenButton ="Frame")
local OpenText ="TextButton")

--Important Stuff
SG.Parent = game.StarterGui
Initiate.Parent = SG
OpenButton.Parent = SG
OpenText.Parent = OpenButton

OpenButton.Size =, 100,0, 46)
OpenButton.Position =, 0,0.928, 0)
OpenButton.BackgroundColor3 =, 129, 129) --Here is issue but idk why :think:
OpenButton.BorderColor3 =, 255, 255)
OpenButton.BorderSizePixel = 5

OpenText.Size =, 100,0, 50)
OpenText.Position =, 0,0, 0)
OpenText.BackgroundTransparency = 1
OpenText.Font = Enum.Font.GothamBlack
OpenText.TextSize = 14
OpenText.TextColor3 =, 255, 255)

On this line of code, OpenButton.BackgroundColor3 =, 129, 129) --Here is issue but idk why :think: the OpenButton is meant to change colours, but when I go into studio everything works well except that. What could be the reason?

1 Like

Everything looks fine to me (though I did not properly go through the code), it might be because of the properties you’ve set for the frame, possible the background is transparent or something else.

You should be parenting to Player.PlayerGui not to StarterGui. Also you are mixing the constructor with Color3.fromRGB. The latter takes input from 0-255 whereas the former takes input from 0-1.


But how come it has worked with the rest of the script and not that one specifically. Also when I set it to PlayerGui, I get an error upon testing the game.

1 Like

I do not know, but if you apply the changes I have recommended it should work

1 Like

Why are you even creating this with a script? You can just make it in editing mode.

Edit: Nvm

Just because I am terribly bored and have nothing better to do and I am also testing a few I thought about

Maybe because he could be practicing scripting and just testing things out?