I've been doing MouseEnter
and MouseLeave
functions for Guis on Roblox for years now, and it hasn't failed me one time (except spelling errors, but that's not the point), however, the code I have for the menu I am creating for fun (which, by the way, is not fun now) isn't working properly, well, the Mouse functions aren't. I checked back multiple times to see if I had any errors in my spelling, locals
, etc. and found no error whatsoever, and this is getting me on my nerves now. In StarterGui
, I have a ScreenGui
called 'MainMenu', and inside the ScreenGui
, I have a Frame
named 'Background', and in the Frame
, I have four objects: two TextButtons
I have is named 'StartButton' and 'AboutButton', a TextLabel
named 'Title', and a LocalScript
called 'MenuCode'. Here's my code in the LocalScript
--\\ Services local Players = game:GetService('Players').LocalPlayer local StarterGui = game.StarterGui local Menu = StarterGui.MainMenu local Background = Menu.Background local Start = StarterGui.MainMenu.Background.StartButton local About = StarterGui.MainMenu.Background.AboutButton local Title = StarterGui.MainMenu.Background.Title --\\ Mouse enter/leave (Start/About buttons) function MouseEnterStartButton() Start.FontSize = Enum.FontSize.Size32 end function MouseLeaveStartButton() Start.FontSize = Enum.FontSize.Size28 end function MouseEnterAboutButton() About.FontSize = Enum.FontSize.Size32 end function MouseLeaveAboutButton() About.FontSize = Enum.FontSize.Size28 end --\\ Recalling functions Start.MouseEnter:connect(MouseEnterStartButton) Start.MouseLeave:connect(MouseLeaveStartButton) About.MouseEnter:connect(MouseEnterAboutButton) About.MouseLeave:connect(MouseLeaveAboutButton)
This issue is getting on my nerves since I am always able to do this, and now Roblox is acting on me now. Can you help me fix this issue?
You are connecting your events to the gui elements in StarterGui rather than the gui elements that are local to the player. To fix this you should change
local StarterGui = game.StarterGui
to
local StarterGui = Players.PlayerGui