Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 answers

✓ Accepted answer

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)

2 comments

0

So I would copy and paste the MovePlayers(Vector3.new(0, 0, 0)) etc 4 times total to make it work?

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.

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

plr = game.Players.LocalPlayer
char = plr.Character
brick = game.Workspace.Yourbrick -- change to your Brick
    char:MoveTo(brick.Position)

Here is an easy way

This discussion is preserved as it was. New answers, comments, and votes are closed.