So I am trying to have each button’s background become visible and change the text color while the mouse is hovering over it and then after the mouse leaves the button it will go back to how it was.
Code:
– Begin Variables
local EnterFacilityButton = script.Parent.MainFrame.EnterFacilityButton
local SelectTeamButton = script.Parent.MainFrame.SelectTeamButton
local ViewStoreButton = script.Parent.MainFrame.ViewStoreButton
local CreditsButton = script.Parent.MainFrame.CreditsButton
– End Variables
– Begin Functions
function Hovering(HoverButton)
HoverButton.BackgroundTransparency = 0
HoverButton.TexctColor3 = Color3.new(255, 255, 255)
end
function EndHovering(HoverButton)
HoverButton.BackgroundTransparency = 1
HoverButton.TexctColor3 = Color3.new(170, 170, 170)
end
– End Functions
– Begin Button Hover Check
if EnterFacilityButton.MouseEnter then
Hovering(EnterFacilityButton)
elseif EnterFacilityButton.MouseLeave then
EndHovering(EnterFacilityButton)
end
if SelectTeamButton.MouseEnter then
Hovering(SelectTeamButton)
elseif EnterFacilityButton.MouseLeave then
EndHovering(SelectTeamButton)
end
if ViewStoreButton.MouseEnter then
Hovering(ViewStoreButton)
elseif EnterFacilityButton.MouseLeave then
EndHovering(ViewStoreButton)
end
if CreditsButton.MouseEnter then
Hovering(CreditsButton)
elseif EnterFacilityButton.MouseLeave then
EndHovering(CreditsButton)
end
– End Button Hover Check
A screenshot of the setup:
(Sorry I forgot how to put Lua in the post)