TriggerEnter

Constructor:

TriggerEnter()

Description

Triggered when the object starts a contact.

Parameters

Name Type Description
RWObject Object in contact

Examples

Create a part p1 and add a contact event to it, and then the event will be triggered by a contact.

local function EnterEvent(res) -- define a method of starting a contact
        print("The event that is triggered when a contact starts>>>>>".." Who touched me:" ..res.Name)
end
local p1 = RWObject.Create("Part") -- create a part
p1.Position = Vector3.New(1,1,1) -- set the coordinates
p1.Anchored = true -- anchor
p1.CanCollide = false -- disable part contact
p1.TriggerEnter:Connect(EnterEvent) -- the event that a contact starts