OnClickEntity||doc136882

September 20, 2022

Format

local event = Entity:GetEvent("OnClickEntity")

Description

Triggered event when player clicks on the the entity.

Callback function parameters

Type Name Introduction
Entity player Player entity that initiated the click
Entity entity Entity that is clicked on
Vector3 clickPos Click on the world coordinates of the detected collision body

Code Example

local event = Event:GetEvent("OnClickEntity")
event:Bind(function(player, entity, clickPos)
    print(player .. " clicked " .. entity .. " in " .. clickPos)
end)