PRODUCTS
EXPERIENCES
APPS & GAMES
SUPPORT
Meta accounts are here: you can create a Meta account to log into VR devices.
Learn more
META HORIZON WORLDS
LEARN TO CREATE
INTRO TO CREATION
INTRO TO HAND TOOLS
INTRO TO GIZMOS
INTRO TO SCRIPTING
PUBLISHING
LOCAL SCRIPTING
EVENTS
MOTION
ACTIONS
RESOURCES
BROWSE TUTORIALS
EVENTS
CONTROL
IF
…
The codeblocks indented below the if line will execute if the condition evaluates to true.
…
ELSE IF
…
Description
…
ELSE
…
Placed directly below an if, will run indented codeblocks if the first if is false. Can also be placed under an else if.
…
WHILE
…
The codeblocks indented below the while line will execute when the condition evaluates to true. This is useful when iterating through a list.
…
EVENTS
WHEN WORLD IS STARTED
…
The object the script is attached to runs when world is started at the start of the world, i.e., when the first person enters the world’s instance or upon using the codeblock reset world state.
…
WHEN EVENT IS RECEIVED
…
The when event is received codeblock is executed when it receives a data transmission called an “event” from either itself or a script attached to another object.
…
EVENT ACTIONS
SEND EVENT TO OBJECT
…
This sets off an event on self. Replacing self with an object variable, allows for the other object to receive the event. You can use this to create communication between multiple objects.
…
SEND EVENT WITH DELAY
…
This sets off an event on self after a delay. Replacing self with a different object, allows for another object to receive the event. Effectively communicating between objects.
…
CANCEL SENDING EVENT WITH DELAY
…
Cancel sending event with delay stops the transmission of a send event with delay event that is still in progress.
…
COLLISION EVENTS
WHEN TRIGGER IS ENTERED BY OBJECT
…
Codeblocks below the when trigger is entered by object line will execute when an object enters the trigger. The trigger must be configured to detect objects with a specific tag, and the object must have that tag.
…
WHEN TRIGGER IS EXITED BY OBJECT
…
Codeblocks below the when trigger is exited by object line will execute when an object exits the trigger.
…
WHEN COLLIDING WITH OBJECT
…
Codeblocks below when colliding with object will execute when another object collides with the object the script is attached to.
…
WHEN COLLIDING WITH PLAYER
…
Codeblocks below the when colliding with player line will execute when a player’s head or torso collides with the object the script is attached to.
…
PLAYER EVENTS
WHEN TRIGGER IS ENTERED BY PLAYER
…
Commands below the when trigger is entered by player line will execute when a player enters the trigger the script is attached to. The trigger must be configured to detect players.
…
WHEN TRIGGER IS EXITED BY PLAYER
…
Description
…
WHEN PLAYER ENTERS THE WORLD
…
Commands below when world is entered by player will execute when a player enters the game world, and again if the world is reset.
…
WHEN PLAYER EXITS THE WORLD
…
Commands below when world is exited by player will execute when a player leaves the world. When editing your world, the when player exits the world event will execute when a player enters build mode.
…
PROJECTILE EVENTS
WHEN PROJECTILE HITS PLAYER
…
Event executes when a projectile, from the launcher gizmo, hits a player.
…
WHEN PROJECTILE HITS INTERACTIVE OBJECT
…
Event executes when a projectile, from the launcher gizmo, hits an interactive object.
…
WHEN PROJECTILE HITS STATIC OBJECT
…
Event executes when a projectile, from the launcher gizmo, hits a static object.
…
GRAB EVENTS
WHEN OBJECT IS GRABBED BY PLAYER
…
Event that runs when the object is grabbed by a player.
…
WHEN OBJECT IS RELEASED BY PLAYER
…
Event that runs when the object is released by a player.
…
WHEN OBJECT IS GRABBED BY TWO HANDS
…
Event that runs when the object is grabbed by a player with two hands.
…
WHEN OBJECT IS RELEASED BY TWO HANDS
…
Event that runs when the object is no longer grabbed by two hands.
…
ATTACHABLE EVENTS
WHEN OBJECT IS ATTACHED TO PLAYER
…
Commands below when object is attached to player will execute when a player attaches an object to their avatar.
…
WHEN OBJECT IS UNATTACHED FROM PLAYER
…
Commands below when object is unattached to player will execute when a player unattaches the object from their avatar.
…
CONTROLLER EVENTS
WHEN INDEX TRIGGER IS PRESSED
…
This event executes when a player presses the index trigger button on their controller while grabbing the object that the script is attached to.
…
WHEN INDEX TRIGGER IS RELEASED
…
This event executes when a player releases the index trigger button on their controller when holding the object that the script is attached to.
…
WHEN BUTTON1 IS PRESSED
…
Depending on which Touch Controller, the right or left, is holding the object, A or X buttons will represent button1.
…
WHEN BUTTON1 IS RELEASED
…
Depending on which Touch Controller, the right or left, is holding the object, A or X buttons will represent button1.
…
WHEN BUTTON2 IS PRESSED
…
Depending on which Touch Controller, the right or left, is holding the object, B or Y buttons will represent button2.
…
WHEN BUTTON2 IS RELEASED
…
Depending on which Touch Controller, the right or left, is holding the object, B or Y buttons will represent button2.
…
CONNECTIONS
CONNECT TO EVENT
…
Connect to event allows you to listen to specific events from other objects, and map them to local events.
…
LISTEN TO EVENTS
…
Listen to allows you to receive all events from another object.
…
QUEST 3
QUEST PRO
QUEST 2
ACCESSORIES
RIFT S
APPS & GAMES
SUPPORT
DEVELOPERS
VR FOR WORK
ALL PRODUCTS
Quest 3
Quest Pro
Quest 2
Quest 2 (Refurbished)
Rift S
Accessories
Quest
Go
Rift
Compare Headset
MORE META QUEST
Forums
Blog
Referrals
VR for Good
Creators
Download SDKs
ABOUT
Careers
Meta Connect
Research
ALL PRODUCTS
Quest 3
Quest Pro
Quest 2
Quest 2 (Refurbished)
Rift S
Accessories
Quest
Go
Rift
Compare Headset
MORE META QUEST
Forums
Blog
Referrals
VR for Good
Creators
Download SDKs
ABOUT
Careers
Meta Connect
Research
Privacy
Legal
© Meta 2024