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.