Wait()function will cause the script to pause until the event occurs once. When it does, the function returns the data associated with the event’s firing.
Connect()function can be used when a given function should run every time an event fires. This function immediately returns a connection object. In the example below, we connect a function,
onTouched(), to a
Workspace. If another part collides with
myPart, the script prints the name of the other part involved in the collision.
Disconnect()method of the connection object returned by