Coding Error Mousebutton1click not working

Whenever I click it does nothing and no error

Code:

script.Parent.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
	if player.Name == "Howlankers" then
		script.Parent.Parent.BlockFrame.Visible = false
	else
		script.Parent.Parent.BlockFrame.Visible = true
	end
end)

Hierachy:
Screenshot 2022-11-13 181728

script.Parent.MouseButton1Click:Connect(function()
    print("click")
	local player = game.Players.LocalPlayer
	if player.Name == "Howlankers" then
		script.Parent.Parent.BlockFrame.Visible = false
	else
		script.Parent.Parent.BlockFrame.Visible = true
	end
end)

does this print "click" at all?

1 Like

try replacing that script with this:

script.Parent.MouseButton1Click:Connect(function()
    print("Button clicked")
end)

and see what happens when you click it

I put print(“click”) and nothing happended so I does that mean

That means script.Parent.MouseButton1Click event is not firing at all.

  • Have you disabled any properties on the button?
  • Try googling "MouseButton1Click not firing".

Ahh wait…

Try placing SurfaceGui inside the PlayerGui, and then setting Adornee=Screen inside SurfaceGui

Yup, I just realized, he has the GUI in the workspace.

It worked thank you so much so was it in workspace the problem

1 Like

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