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

Teleport players to lobby from map?

Asked by 10 years ago

How you teleport players to lobby from map?

4 answers

Log in to vote
2
Answered by
Sublimus 992 Moderation Voter
10 years ago
for i,v in pairs(game.Players:getChildren()) do
    if v:findFirstChild("Character") then
        v.Character.Torso:MoveTo(0,0,0) -- change this to a position within the lobby
    end
end
Ad
Log in to vote
-1
Answered by 10 years ago

for _, v in pairs (game:GetService('Players'):GetPlayers()) do v.Character.Torso:MoveTo(POSITION) end

Log in to vote
-1
Answered by 10 years ago

Well, you would have to make a boolean value to check if they are in the map.

--lets say the lobbys floor is named lobfloor--
inmap = false
if inmap == true then
for i,v in pairs(game.Players:GetPlayers()) do
v.Character.Torso.CFrame = Workspace.lobfloor.CFrame * CFrame.new(math.random(10), 5, 0))
--math.random for not getting stuck--
end
--lets say the maps floor is named base--
Workspace.base.Touched:connect(function(tuch)
inmap = true
end)

As you can see, we made a boolean value called inmap. If its false, it does nothing. If its true, it teleports all players to the lobby, hence when the maps floor is touched the boolean value is set to true, and instantly sends all of the players to the lobby.

Log in to vote
-1
Answered by 10 years ago

You could use something physical like a 1 way tele or write in a script what the guy said above me

Answer this question