TeleportToSpawnByName (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Samacado
No edit summary
m Text replacement - "</SyntaxHighlight>" to "</syntaxhighlight>"
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
<onlyinclude>{{Method
<onlyinclude>{{Method
|name                = TeleportToSpawnByName
|name                = TeleportToSpawnByName
|arguments            = [[int]] PlaceId, [[string]] SpawnName
|arguments            = [[int]] placeId, [[string]] spawnName
|returns              = [[nil]]
|description          = Teleports someone like [[Teleport_(Method)|Teleport]], but has a second argument allowing someone to teleport to a certain spawn. However, the spawn must have its Neutral property true.
|description          = Teleports someone like [[Teleport_(Method)|Teleport]], but has a second argument allowing someone to teleport to a certain spawn. However, the spawn must have its Neutral property true.
|object              = TeleportService
|object              = TeleportService
Line 10: Line 9:
{{clear floats}}
{{clear floats}}


{{Example|<code lua>
{{Example|
game:GetService("TeleportService"):TeleportToSpawnByName("1818", "TeleportSpawn") -- Will teleport a player to "Crossroad" a game by ROBLOX, 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.
</code>}}
<syntaxhighlight lang="lua">
game:GetService('TeleportService'):TeleportToSpawnByName(1818, "TeleportSpawn")
</syntaxhighlight>}}


==See Also==
*[[TeleportService]]
*[[Teleport_(Method)|Teleport]]


[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 06:17, 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")


See Also