Gui button bug?

I have an x button that closes a store gui in my game. It used to work, but for some reason, mousebutton1click doesn’t work for me anymore, I have tried creating new buttons, but those don’t work either. This code doesn’t output anything. I have no idea what could be causing this. Any help is appreciated. Thanks!

script.Parent.Exit.MouseButton1Click:Connect(function()
	print("inv")
	script.Parent.Visible = false
end)
3 Likes

Tested the code and it printed inv in the output. Something else is causing the problem.

2 Likes

Yeah, I think it may be some kind of studio bug. I have used this code before and it works. I may try to repost this in a different category for bug reports.

2 Likes

Can you post a fully unfolded hierachy screenshot of the GUI affected by this script?

2 Likes

Screenshot (116)
x is the script and Exit is the button.

2 Likes

the script is a local script so it’s only printing on the client output so you wont see it on the server side. Try viewing the output on the client, The code works

2 Likes

Okay so seemingly, “Exit” is an ImageButton. Could you send a screenshot of how the GUI is looking?
What is the ImageLabel for?

Check that nothing covers the whole X ImageButton. Not even invisible elements.

2 Likes

Try changing the Exit’s button ZIndex value to a high number (on properties) to make sure that nothing is blocking you from clicking the button. If that works, try searching which GUI was blocking the button.

If nothing works, then it’s a bug

2 Likes

It’s not like a plugin causing this somehow?

1 Like


This is the whole gui. Everything other than the x script and the Exit button are other aspects that I don’t think are affecting it. It also can’t be an issue with the zindex because I have tried moving the button to outside the frame. Thanks for the help so far!

1 Like

Is any element covering the ImageButton?

no, there’s nothing on top of it, zindex is 999, and I’ve even tried moving it outside the frame.

Honestly if so, I don’t really know what to recommend you and I have no clue what could cause this, sorry.

1 Like

I know this is useless but try to print something in the script x out of the function MouseButton1Click

I guess it’s the case, but just to make sure, are you sure the name of your button is “Exit” and not "Exit "?

I’ve been also trying to close a GUI when the player clicks a ButtonGUI and it didn’t work, no output.

That def. is a bug they gotta fix, don’t worry about that.
Post it in the bugs section so an admin can create a ticket to fix the bug.

Hey, if anyone is viewing this and is having the same problem, I found a decent enough solution until Roblox fixes image buttons. If you put a transparent text button on top of the image button and detect clicks for that instead, it should work.

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