How do you Teleport a Player from Game to Game? I would like to know and understand a Script that allows you to click a Button which would Teleport you from the Game you are currently in to a different game.
How do you Teleport a Player from Game to Game?
3 answers
Because Dawn did not explain his script and Finick did not do it for when you click a button, or explain his script. Here.
local ts = game:GetService('TeleportService') -- Get the Teleport Service
local placeid = 123 -- Replace with your PlaceId
function clicked(playerWhoClicked) -- Handle being clicked
ts:Teleport(placeid,playerWhoClicked) -- Teleport the player
end -- End the function
script.Parent.ClickDetector.MouseClick:connect(clicked) -- Run the Function once clicked
6 comments
Thank you!
I only have one question. What do I enter for TeleportService? Do I enter the Part that is being clicked?
You're only supposed to edit the placeid, and the script.Parent.ClickDetector part.
What am I supposed to enter for the script.Parent.ClickDetector part?
For example, if you have a Part in Workspace named Part, and there's a ClickDetector inside it do game.Workspace.Part.ClickDetector
Nevermind! It worked! I accidentally placed my Script in the ClickDetector!
Problem Il make the script but this is not a request site.
function teleport(placeid, player)
game:GetService('TeleportService'):Teleport(placeid,player)
end
1 comment
Where do I type in the Game ID?
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):TeleportToSpawnByName((281925931), "(SpawnLocation)", player)
end
end
script.Parent.Touched:connect(onTouched)
3 comments
Spawn point? Can you please repeat the same thing but please put example IDs in the Script.
ok ...
ok, i changed it :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
http://wiki.roblox.com/index.php?title=Teleport
Please give an example. I am very new to Lua Scripting and I do not understand this particular Script.