Home / Lua / Events / Client / MouseDown

Name    MouseDown
Arguments (in table)    number button
Return option    None

Description

Fired when a mouse button is pressed.
button is from 1 to 5:
  1. Left click
  2. Right click
  3. Middle click
  4. Back button
  5. Forward button

Examples

Foo = function(args)
	local message = "Mouse button "..args.button.." pressed"
	Chat:Print(message, Color(255, 255, 255))
end

Events:Subscribe("MouseDown", Foo)

Foo = function(args)
	if args.button == 1 then
		local position = Mouse:GetPosition()
		local message = "Player left-clicked at position x: " .. position.x .. " y: " .. position.y
		Chat:Print(message, Color(255, 255, 255))
	end
end

Events:Subscribe("MouseDown", Foo)