Why can I use MouseEnter and MouseLeave on Server but not MouseButton?

I have this script on Server:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect( function(Player)
	local Player = game.Players:WaitForChild(Player.Name)
	local PlayerGui = Player:WaitForChild("PlayerGui")
	local Gui = PlayerGui:WaitForChild("ScreenGui")
	local Frame = Gui:WaitForChild("Frame")
	local Img = Frame:WaitForChild("ImageLabel")	
	
	Img.MouseEnter:Connect(function()
		print('Enter')
	end)
	
	Img.MouseLeave:Connect(function()
		print('Leave')
	end)

	--Img.MouseButton1Click:Connect(function()
	--	print('click')
	--end)
end)

for this Screengui:
image

When I run it, MouseEnter and MouseLeave work ok.
But if I try MouseButton1Click I get:

MouseButton1Click is not a valid member of ImageLabel “Players.rogeriodec_games.PlayerGui.ScreenGui.Frame.ImageLabel”

If MouseEnter and MouseLeave are working, why not MouseButton1Click, since both are mouse events?

Image labels aren’t meant to be clicked on, use image button instead.

https://developer.roblox.com/en-us/api-reference/class/ImageButton

1 Like

You need to use an ImageButton for the Mouse Properties
You cannot use MouseEnter and MouseLeave on an ImageLabel as its just for displaying.

Add a solution if this helped!

1 Like

:flushed:
Shame on myself…thank you.

You are welcome, dm me if you need anything.

1 Like