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

Teleporting 10 Players to 10 Parts?

Asked by
Tor6 0
10 years ago

I'm building a game where it picks a map, places it in workspace, and then teleports players to that map. I already have it down, but my problem is I want it to send 10 players to 10 different parts that are close to each other. Kind of what you see in Laser Tag Arena or in The Mad Murderer where it spreads the players apart. I want the 1st part of the script to look like this,

for i, player in pairs (game.Players:GetChildren()) do
-- code for teleporting 10 players goes here
end

Can anyone help me? Do I just send the players to 10 different parts that have the same name or something?

1 answer

Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
10 years ago
parts = {}

for _,v in pairs(map:GetChildren()) do                          -- tele pads from map
    if v:IsA("BasePart") and v.Name == "TeleportPad" then
        table.insert(parts,v)
    end
end


for i,player in pairs(game.Players:GetChildren()) do
    player.Character:MoverTo( parts[I].Position )
end


Ad

Answer this question