Meta accounts are here: you can create a Meta account to log into VR devices. Learn more

LIMITATIONS

Player enter and player exit events are unable to run on local scripts. If a local script needs to receive an event when its owner enters the world, use a default script to receive the player enter event. Then, if the index of the player equals the index that is assigned to that object, transfer ownership of the local script object to the player. This automatically causes the world start event to run for the local object, and the event can be sent when the world starts. The default script cannot send an event to the local script in the player enter event because a transfer of ownership will prevent the event from being received.

If a player is holding a local object or has a local object attached when they leave the world, the ‘grabend’ and ‘attachend’ events will not run. If those events are important to your local script, use a default script to send the ‘grabend’ or ‘attachend’ events with the player as a parameter when the player exits the world.

Local scripts are unable to get or set player persistent variables. If a local script needs to get a player persistent variable, first send an event to a default script that gets the variable. Then send it to the local script in an event as a parameter. If a local script needs to set a player persistent variable, send an event to a default script with the number as a parameter, then set the player persistent variable to the parameter when the event is received.

Local scripts are unable to listen to events from default scripts, and default scripts are unable to listen to events from local scripts. The event must be sent directly from the local script to the default script or vice versa.

PREREQUISITE READING

CHECK IF OWNED BY PLAYER precedes this tutorial


Seen above is the script used on a Local Script Manager.