gspawn = chosenMap.GreenSpawns:GetChildren()
yspawn = chosenMap.YellowSpawns:GetChildren()
for i,v in pairs(game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if v.TeamColor == BrickColor.new("Lime green") then
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
local distance = math.random(-4, 4);
check:MoveTo(gspawn.Position + Vector3.new(distance, distance, distance))
v.Team.Value = "Lime green"
end
end
elseif v.TeamColor == BrickColor.new("New Yeller") then
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
local distance = math.random(-4, 4);
check:MoveTo(yspawn.Position + Vector3.new(distance, distance, distance))
v.Team.Value = "New Yeller"
end
end
end
end
The GreenSpawns and YellowSpawns are models inside 'chosenMap' and their children are spawn models. There is a problem. 1. The players dont teleport to the spawns, and if there arent models then every player spawns to one brick. Please help. I just want it to get the spawn models in the game and teleport every player to the game to a random spawn that corresponds to the players team.
