queueonteleport
Queues a script to run after teleporting.
Syntax
queueonteleport(script: string) -> voidAliases
queue_on_teleportqueueteleport
Parameters
| Parameter | Type | Description |
|---|---|---|
script | string | The Lua code to run after teleport |
Returns
This function does not return a value.
Description
queueonteleport queues Lua code to be executed after the player teleports to another place. The script will run once the new place loads.
Example
-- Queue a script to run after teleporting
queueonteleport([[
print("Teleported successfully!")
-- Your script code here
]])
-- Teleport the player
game:GetService("TeleportService"):Teleport(placeId)Auto-Execute Example
-- Queue the current script to run again
queueonteleport(game:HttpGet("https://example.com/script.lua"))Notes
- Only one script can be queued at a time
- Use
clearqueueonteleportto clear the queue - The script runs in a fresh environment
Related Functions
clearqueueonteleport- Clear the queue