PcoWSkbVqDnWTu_dm2ix

Connecting to an Event Only Once

Connecting to an Event Only Once

Jun 14 2019, 4:47 PM PST

You want to use some of the others members of events.

Use several of the other methods besides connect.

local hit = Workspace.Part.Touched:wait()
print(hit)

There are quite a few unknown members of events. One of the most useful is the :wait method. This function will wait until the event occurs and then return the values usually supplied as arguments to a callback function. Therefore if you only want to connect an event once, you should use the wait function.

Tags:
  • events
  • touch
  • wait