TeleportToSpawnByName (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
m Text replacement - "</code>" to "</SyntaxHighlight>" |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" |
||
Line 11: | Line 11: | ||
{{Example| | {{Example| | ||
This code will teleport a player to Crossroads, and if there is a spawn named "TeleportSpawn" then the player would spawn on it. | This code will teleport a player to Crossroads, and if there is a spawn named "TeleportSpawn" then the player would spawn on it. | ||
< | <syntaxhighlight lang="lua"> | ||
game:GetService('TeleportService'):TeleportToSpawnByName(1818, "TeleportSpawn") | game:GetService('TeleportService'):TeleportToSpawnByName(1818, "TeleportSpawn") | ||
</SyntaxHighlight>}} | </SyntaxHighlight>}} |
Revision as of 03:58, 27 April 2023
Local: This item should be used with a LocalScript in order to work as expected in online mode.
TeleportToSpawnByName( int placeId, string spawnName ) | |
Returns | nil |
Description: | Teleports someone like Teleport, but has a second argument allowing someone to teleport to a certain spawn. However, the spawn must have its Neutral property true. |
Member of: | TeleportService |
Example
This code will teleport a player to Crossroads, and if there is a spawn named "TeleportSpawn" then the player would spawn on it.
game:GetService('TeleportService'):TeleportToSpawnByName(1818, "TeleportSpawn")