Player Spawn Points

I don’t know how to set spawn points. So how would i go about doing, say when a player joins the server that they initially spawn in those defined positions.

Im assuming that you hook it to the initalspawn.

Bump anyone help?

Try this:

	 		**[Team.SetSpawnPoint

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Team.SetSpawnPoint)**

So like this?

[lua]team.SetSpawnPoint(Vector(100,100,100 ))[/lua]

And what if i wanted multiple spawn points with it being randomized where you spawn?

Honestly, I use a different method.

And that would be wrong because it has the wrong syntax.

I would use something like this:

init.lua
[lua]
local TeamOneSpawnPoints = {
Vector(x,y,z),
Vector(x,y,z),
Vector(x,y,z)
}

local TeamOneRandomSpawnPoint = table.Random(TeamOneSpawnPoints)

local TeamTwoSpawnPoints = {
Vector(x,y,z),
Vector(x,y,z),
Vector(x,y,z)
}

local TeamTwoRandomSpawnPoint = table.Random(TeamTwoSpawnPoints)

function GM:PlayerSpawn(pl)
if pl:Team() == 1 then
pl:SetPos(TeamOneRandomSpawnPoint)
elseif pl:Team() == 2 then
pl:SetPos(TeamTwoRandomSpawnPoint)
end
end
[/lua]

This creates local tables (e.g. TeamOneSpawnSpoints) and variables (e.g. TeamOneRandomSpawnPoint) to determine where the player will be set when they spawn depending on which team they are a part of.

Alright thanks brah, I figured I used wrong syntax above.

team.SetSpawnPoint is broken afaik