OnClick||doc136715

September 20, 2022

Format

local event = BasePart:GetEvent("OnClick")

Describe

Triggered when a part is clicked.

Callback function parameters

Type name introduce
BasePart part Current part
Entity entity Entity that initiated the click
Vector3 pos Clicked location

Code example

Register part click events on the client

local map = World.CurMap
local part = Instance.new("Part", map.Root)

local event = part:GetEvent("OnClick")
event:Bind(function(part, entity, pos)
    print("click part!", part, entity, pos)
end)