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 Part
in the 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 Connect()
.Player
joins the game, the Players.PlayerAdded
event fires with a reference to the new player.CharacterAdded
event of the Player
involved in the Players.PlayerAdded
event.