OnCollisionBegin||doc136716

September 20, 2022

Format

local event = BasePart:GetEvent("OnCollisionBegin")

Describe

Triggered when parts collide.

Callback function parameters

Type name introduce
BasePart selfPart Current part
Instance other The other instance that collided

Code example

Register the part collision event on the server

local map = World:GetStaticMap("map001")
local part1 = Instance.new("Part", map.Root, {
    Position = Vector3.new(0,1,0)
})

local part2 = Instance.new("Part", map.Root, {
    Position = Vector3.new(0,3,0)
})

local event = part1:GetEvent("OnCollisionBegin")
event:Bind(function(selfPart, other)
    print("OnCollisionBegin!", selfPart, other)
end)