SurfaceGui color issue

Hi, so I’ve been developing a game and I’ve come across a problem. I’ve been stuck on this for a little bit now, I have no clue how to solve it nor how to attempt to solve it. I was hoping someone on the forum could help me figure out why this isn’t working.

I have a LocalScript that’s supposed to change the background color of a Frame in a SurfaceGui whenever the mouse enters the Gui. Then whenever the mouse leaves the Gui, it returns to its previous color. However, whenever the mouse enters the Gui it changes to a color that I did not want and stays that color even when the mouse leaves the Gui.

Here’s the code:

--- Variable ---

local gMenuFrame = game.Workspace.garageMenu.SurfaceGui.Frame

--- Main Code ---

function mouseEnterG1()	
	gMenuFrame.ScrollingFrame.Frame.BackgroundColor3 = Color3.new(129, 131, 130)
end 

function mouseLeaveG1()	
	gMenuFrame.ScrollingFrame.Frame.BackgroundColor3 = Color3.new(111, 111, 111)
end 


gMenuFrame.ScrollingFrame.Frame.MouseEnter:Connect(mouseEnterG1)
gMenuFrame.ScrollingFrame.Frame.MouseLeave:Connect(mouseLeaveG1)

This is what happens in-game:

I don’t know if something is interfering with it or what, if you need anything else to help fix this problem, I will gladly give it forth.

2 Likes

Color3.new() only takes values between 0->1 this is explained in the documentation
if you want to use a value outside of that range you can use

Color3.fromRGB(0,0,0)

2 Likes

Yep, if I’m being honest I didn’t check the Wiki when that was the first thing I should’ve checked. Thanks for the help, I’ll keep this in mind now.