When Im using MouseButton1Click its not working

When I’m using MouseButton1Click its not working, and I have cheeked that the ui object existed and its zInded but it still doesn’t work.
Screenshot 2023-01-27 171147
Screenshot 2023-01-27 171111

Can you please show us the code? Your GUI hierarchy looks fine. Showing the code to us will help us understand better. Also, please tell us any errors you have encountered in the Output tab.

1 Like

I encountered no errors

local Menu = game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain
local MenuButton =  game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneHUD.Menu.Frame.ImageButton

local Buttons = Menu.Apps.Home.Apps

Buttons.Cash.Button.MouseButton1Click:Connect(function()
	warn("HIE")
end)
2 Likes

Is this a server script or a local script? Also, where is this script located at?

localscript in StarterCharacterScripts

That’s weird, your script is working fine, I don’t see any issues, could you try restarting studio and rerun the script? Try using print statements in the script to ensure your script is actually running.

MouseButton1Click should be handled on the server or client. Try using the server to see if it is a client related issue.

Try using .Activated instead (this will only work on the client, unlike MouseButton1Click).

1 Like

Still doesn’t work…

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Does that mean using .Activated event on the GUI button doesn’t make the .Activated event fire?

the script can’t be in startera character script put it inside the gui so it can work

False. I tried to use the script in StarterCharacterScripts container and my local script worked just fine.

in the case of a gui it is different

remember that the gui are cloned therefore the script
I don’t know which one is correct
In addition, you can put any local script in starter character script since it works that way but if you make a button send a “MouseButton1Click” event or the event of a button, the script must be inside the GUI but this should also be the case. like son of the button

Still doesn’t support your point. Local scripts can run if it is a descendant of a player character’s model.

Im just confused why my scipt is not working, and I have the same script being used to detect when the mouse is over the gui and it works fine

@MasonX890 Try restarting studio and see if it resolves the issue.

please friend if you are lazy to open the studio you will never achieve anything try it the guis are very different so read the documentation UI | Roblox Creator Documentation

Nope, Still no luck

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Also, what if you put some print in the part where the event is fired, because if you do, you will know where the error is

The link provided has nothing to do with scripts running in GUIs. Also mind your behavior when you are trying to communicate with someone on here. Be respectful.