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

How do I make it so when a match starts, the players will be taken from the lobby, to the map?

Asked by 10 years ago

I have 4 different positions for the 4 maps I have atm. Please help.

3 answers

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

It depends on how you want to spawn the players really, but this might help you get a general idea.

function MovePlayers(...) -- function declaration
    local spawns = {...}
    for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do -- iterate through table of players
        if plr.Character then -- if character exists, then
            plr.Character.Torso.CFrame = CFrame.new(spawns[math.random(#spawns)]) -- move their torso to a random spawn
        end
    end
end

-- usage
MovePlayers(Vector3.new(0, 0, 0), Vector3.new(100, 0, -100), Vector3.new(-400, 0, 50))
MovePlayers(Spawn.Position, Spawn2.Position, Spawn3.Position)
0
So I would copy and paste the MovePlayers(Vector3.new(0, 0, 0)) etc 4 times total to make it work? zachhg03 35 — 10y
0
Well, it depends what you want to do. I'm assuming you want each player to just go to one of the spawns you have, so I'll make an edit for that to work. Ekkoh 635 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Make a teleportation script then set the coordinates of the 4 locations in the script, then set up the timer or random math function in the script. Hope this helped :3

Log in to vote
-1
Answered by 10 years ago
plr = game.Players.LocalPlayer
char = plr.Character
brick = game.Workspace.Yourbrick -- change to your Brick
    char:MoveTo(brick.Position)

Here is an easy way

Answer this question