Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you Teleport a Player from Game to Game?

Asked by
SirPaco 66
9 years ago

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.

0
Please give an example. I am very new to Lua Scripting and I do not understand this particular Script. SirPaco 66 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago

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
0
Thank you! SirPaco 66 — 9y
0
I only have one question. What do I enter for TeleportService? Do I enter the Part that is being clicked? SirPaco 66 — 9y
0
You're only supposed to edit the placeid, and the script.Parent.ClickDetector part. ISellCows 2 — 9y
0
What am I supposed to enter for the script.Parent.ClickDetector part? SirPaco 66 — 9y
View all comments (2 more)
0
For example, if you have a Part in Workspace named Part, and there's a ClickDetector inside it do game.Workspace.Part.ClickDetector ISellCows 2 — 9y
0
Nevermind! It worked! I accidentally placed my Script in the ClickDetector! SirPaco 66 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Problem Il make the script but this is not a request site.

function teleport(placeid, player)
game:GetService('TeleportService'):Teleport(placeid,player)
end
0
Where do I type in the Game ID? SirPaco 66 — 9y
Log in to vote
0
Answered by 9 years ago
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)

0
Spawn point? Can you please repeat the same thing but please put example IDs in the Script. SirPaco 66 — 9y
0
ok ... FinickOdre123 6 — 9y
0
ok, i changed it :) FinickOdre123 6 — 9y

Answer this question