OnEntityClick||doc136881

September 20, 2022

Format

local event = Entity:GetEvent("OnEntityClick")

Description

Triggered event when the entity is clicked on.

Callback function parameters

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

Code Example

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