MouseButton1Click not working

Hey everyone! The title says it all, I’ve been searching on a solution for my problems (as it seems that this bug is something common) but I couldn’t find any really useful. Here’s my simple script:

local TS = game:GetService("TweenService")
local Button = script.Parent
local Hover = Button.Hover
local Debounce = false
local WindowOpen = false

Button.MouseButton1Click:Connect(function()
print("Hi")
end)

Button.MouseEnter:Connect(function()
TS:Create(Hover, TweenInfo.new(.5), {ImageTransparency = 0}):Play()
end)

Button.MouseLeave:Connect(function()
TS:Create(Hover, TweenInfo.new(.5), {ImageTransparency = 1}):Play()
end)

The funny part is that MouseEnter and MouseLeave works perfectly

Ensure this is a local script and that button is an actual text/image button.

1 Like

Make sure the button is Active, and that no element covering it is Active.

1 Like

Could the Button.Hover bit be blocking the event?

2 Likes

Did you try it without the MouseEnter and MouseLeave? Making the image transparent might’ve made it harder to click.

2 Likes

What can be causing the issue?

  • Disabled button or script
  • Server Script (which ISN’T a localscript)

What can help solve the issue?

  • Turn on the localscript if it’s disabled
  • If it’s a server script, convert it to a localscript for it to correctly work.

If the problem still persists, please screenshot the Explorer where the script is placed!
1 Like

They said that other things are printing, so the script is enabled and local

1 Like

Are you sure you’re using an ImageButton (or TextButton, but not in this case)?
Please check you’re referencing a button and not an imageLabel in the script, because imageLabels work with mouseEnter and mouseLeave but not with MouseButton1Click. This could be your issue.

2 Likes

Dumbest mistake I’ve ever done :woozy_face:

1 Like

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