M MY Multiplayer: Wiki
Side
Kind

onClientClick

ClientEvent

Fired when a mouse button is pressed or released while the cursor is showing.

addEventHandler("onClientClick", root, function(string button, string state, float absoluteX, float absoluteY, float worldX, worldY, worldZ, element|false clickedElement) … end)

Handler parameters

NameTypeDescription
buttonstring"left", "middle" or "right".
statestring"down" on press, "up" on release.
absoluteXfloatThe cursor's horizontal position in pixels.
absoluteYfloatThe cursor's vertical position in pixels.
worldX, worldY, worldZfloatThe world point under the cursor where the line of sight hits something, or the point 300 units ahead when it hits nothing.
clickedElementelement|falseThe element hit, or false if there is no element there.

Source

The root element (root).

Example

addEventHandler("onClientClick", root, function(button, state, x, y, wx, wy, wz, clicked)
    if button == "left" and state == "down" and clicked then
        outputDebugString("Clicked a " .. getElementType(clicked))
    end
end)

See also