Button Events are not firing when clicked?

Hello everyone,
I seem to have an Issue with my script that applies settings locally.
Whenever a button is clicked it should apply the settings however it is not changing or printing anything. It seems like the MouseButton1Click event is not firing as whenever I click the button it should Run a local function and then print as seen below

_MusicTabButton.MouseButton1Click:Connect(function()
    _OpenMusicTab()
    print("Opening Music Tab from Button")
end)

But as you can see after clicking buttons, it doesn’t print:

prints saying “Loaded” being from this part of the script:
image

There is no further errors or warnings that occur, there’s no type errors within the script whenever I use --!strict and the script is located in StarterPlayerScripts
I have tried using

_MusicTabButton.MouseButton1Click:Connect(function()
    _OpenMusicTab()
    print("Opening Music Tab from Button")
end)

Instead of:

 _MusicTabButton.MouseButton1Click:Connect(_OpenMusicTab)

I have also tried moving the script into another folder such as StarterGui
Any help will be greatly appreciated

1 Like

The contents of the startergui gets cloned into the playergui, so references should point to the playergui instead.

1 Like

I put PlayerGui but now it’s saying it cant find it?

nevermind this totally works, Thank you so much!

The playergui can be a bit slow loading all the elements, currently the prints are a bit misleading as even if the find first child returns nil the print would say it has loaded.
It’s safer to use both find first child and WaitForChild:

local _SettingMenu = startergui:FindFirstChild("MainFrame") or startergui:WaitForChild("MainFrame", 3)
print("settingsmenu is:", _SettingsMenu)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.