Help With Teleporting Players And Team Setting?
01 | function getPlayerNumberInTeam(TeamColor) |
03 | for index,player in pairs (game.Players:GetChildren()) do |
04 | if tostring (player.TeamColor) = = TeamColor and not player.Neutral then |
11 | print (getPlayerNumberInTeam( tostring (game.Teams.Dead.TeamColor))) |
15 | while debounce = = true do |
16 | if getPlayerNumberInTeam( tostring (game.Teams.Death.TeamColor)) = = 0 or getPlayerNumberInTeam( tostring (game.Teams.Runners.TeamColor)) = = 0 then |
23 | for i, player in ipairs (game.Players:GetChildren()) do |
24 | player.TeamColor = game.Teams [ "Dead" ] .TeamColor |
25 | player.Character:MoveTo(game.Workspace.SpawnLocation.Position + Vector 3. new( 0 , i * 5 , 0 )) |
Ok, so it's easier for people to help me with this, I will explain what every part of the script does (or at least what it's supposed to do).
1 | function getPlayerNumberInTeam(TeamColor) |
3 | for index,player in pairs (game.Players:GetChildren()) do |
4 | if tostring (player.TeamColor) = = TeamColor and not player.Neutral then |
This is a function that gets the number of players in a certain team that you input the color of post-function script.
1 | print (getPlayerNumberInTeam( tostring (game.Teams.Dead.TeamColor))) |
This will use the function to print the number of players in the team color or teamname.teamcolor that you insert at the end of the command there.
2 | while debounce = = true do |
3 | if getPlayerNumberInTeam( tostring (game.Teams.Death.TeamColor)) = = 0 or getPlayerNumberInTeam( tostring (game.Teams.Runners.TeamColor)) = = 0 then |
This is supposed to wait until there aren't any players in one of the two teams: Death or Runners
1 | for i, player in ipairs (game.Players:GetChildren()) do |
2 | player.TeamColor = game.Teams [ "Dead" ] .TeamColor |
3 | player.Character:MoveTo(game.Workspace.SpawnLocation.Position + Vector 3. new( 0 , i * 5 , 0 )) |
It should then put everyone in the team "Dead" and teleport them to the spawn point.
The script makes it up to the part where it checks Death and Runners for players, but then it doesn't do anything. Some help?