September 20, 2022


local event = Entity:GetEvent("OnCollisionBegin")


Triggered when entity collides.

Callback function parameters

Type Name Introduction
Entity selfEntity Current Entity
Instance other The other instance that collided

Code Example

Register the entity collision event in the server side, place a few Parts in the map, and collide with the Parts to trigger the event

-- Player is a player entity, and the acquisition process is omitted here
local player

local event = player:GetEvent("OnCollisionBegin")
event:Bind(function(selfEntity, other)
    print("OnCollisionBegin!", selfEntity, other)