Release the mouse and only then MouseButton1Click will be fired…
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Gui = PlayerGui:WaitForChild("ScreenGui")
local Frame = Gui.Frame
local Button = Frame:WaitForChild("ImageButton")
Button.MouseButton1Click:Connect(function()
print("Button: ", Button)
end)
Well, it is called “Click” for a reason, you need to finish the click for it to run. if you want it to run while they are holding, you would use Button.MouseButton1Down
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Gui = PlayerGui:WaitForChild("ScreenGui")
local Frame = Gui.Frame
local Button = Frame:WaitForChild("ImageButton")
Button.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Right input")
else
print("Wrong input")
end
end)
This should fire at the moment a mouse button is pressed.