MouseButton1Click Error


I’m currently working on a custom stage selector for an obby game. It allows you to navigate through the stages you have already completed.

However, the MouseButton1Click event for the button (which allows you to go back to a stage) isn’t firing when it’s supposed to. No matter how many times I click the button, the statement that indicates whether the button has been clicked never prints.

Here’s the code, located in a LocalScript inside the button:

local Players = game:GetService("Players")

local button = script.Parent
local number = script.Parent.Parent.Parent.INT

local player = Players.LocalPlayer
local stage = player:WaitForChild("leaderstats"):WaitForChild("Stage")
local checkpointsFolder = workspace:WaitForChild("CHECKPOINTS")
local maxStages = 13

	print("The button was clicked.") -- This statement doesn't print.
	if number.Value > 1 then
		number.Value = number.Value - 1
		if player then
			if player.Character then
				local character = player.Character
				if character:FindFirstChild("Humanoid") then
					if character:FindFirstChild("HumanoidRootPart") then
						local hrp = character.HumanoidRootPart
						hrp.CFrame = checkpointsFolder:FindFirstChild(number.Value).CFrame +,3,0)

Nothing, not even errors or warnings about the code, print in the output. I’m genuinely confused since this was working before. The event only stopped firing yesterday, and I don’t know why.

I’ve tried replacing the MouseButton1Click event with the Activated event, but I got the same result. I also tried to find a topic on the DevForum that would help, but all of the solutions mention the ZIndex. I’m almost certain that this isn’t the source of the issue because the ZIndex of the button is greater than any other UI element in the ScreenGui I have.

If you have any idea as to why the event isn’t firing properly, please reply below.

Thank you.

Edit: I realized that no matter where I place the button in the ScreenGui, if they’re touching a certain TextLabel, the event won’t fire. Weird.

Try changing the ZIndexBehavior of the ScreenGui to Global, and retry with the ZIndexes


Hi DecodedMint!

This is definitely strange. On top of what @1Joeb said, I’m interested in knowing if you’ve tried using MouseButton1Down or even MouseButton1Up to see if that works?

Have you searched for similar issues like yours? There seems to be a similar problem that has been covered before here MouseButton1Click Not Being Detected - #10 by colbert2677.


I have actually tried that solution before (it was mentioned in one of the DevForum topics I viewed), but it doesn’t make a difference.


Nope. Unfortunately, the MouseButton1Down and MouseButton1Up events don’t fire, either.


I did search the DevForum, actually, as stated in my post:

One of the topics I viewed was the one you linked in your reply. The solution wasn’t relevant to my issue, because the button I’m using is inside (and on top) of a TextLabel, which cannot be clicked. There’s another button inside the TextLabel as well, but it doesn’t overlap the one I’m talking about.

Make sure none of the variables are yielding the thread, since you’re using :WaitForChild()

Can we see your explorer? That would really help

What gui object are you using as the button?

Are you using a TextButton or an ImageButton?

None of the variables are yielding the code. Here’s the screenshot you requested, which should also answer @Ethanthegrand14’s question:


Still doesn’t really answer my question. those could either be text boxes or text buttons.

Since I’m talking about a button, it’s a TextButton.

Can you send a place file? Because your code and layout looks fine. There might be something else causing this not to work.

Send it to me,too. I will figure something out send to DM

I solved the issue.

It was because an invisible Frame in a different ScreenGui was covering the button, so apparently the MouseButton1Click event didn’t get picked up.

Thank you all for replying.

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