Luduvo Contents
Theme
On this page

TouchEvent

two entities starting or stopping contact this frame

Fields

3 members

a: Instance

first entity involved in the contact

b: Instance

second entity involved in the contact

began: boolean

whether the contact began this frame or ended

Reacting to Contacts That Began

Lifecycle: Shared

Draining hands over the contacts recorded since the last call and empties the buffer, so a pair is reported once.

Luau
local events, dropped = game.Physics.DrainTouchEvents()if dropped then	warn("Contact buffer overflowed; some pairs were lost")endfor _, event in ipairs(events) do	if event.began then		print(string.format("%s touched %s", event.a.Name, event.b.Name))	endend