I need to fix this error in my Team Death Match game. Help?
13 | local weapon = game.ReplicatedStorage:WaitForChild( "Sword" ) |
15 | local matchIsInProgress = false |
16 | local Raiders = game.Teams.Raiders:GetPlayers() |
17 | local Knights = game.Teams.Knights:GetPlayers() |
20 | function spawnTeam(team) |
23 | for _, player in pairs (team:GetPlayers()) do |
24 | local teamSpawns = game.Workspace [ team.Name ] :GetChildren() |
25 | local randomSpawn = teamSpawns [ math.random( 1 ,#teamSpawns) ] |
27 | player.Character.HumanoidRootPart.CFrame = randomSpawn.CFrame |
31 | function givePlayersRandomTeams() |
32 | local players = game.Players:GetChildren() |
34 | for _, player in pairs (game.Players:GetPlayers()) do |
35 | local teamsTable = { game.Teams.Knights, game.Teams.Raiders } |
36 | local randomTeam = teamsTable [ math.random( 1 ,#teamsTable) ] |
38 | player.Team = randomTeam |
42 | function givePlayersWeapons() |
43 | for _, player in pairs (game.Players:GetPlayers()) do |
44 | local clone = weapon:Clone() |
45 | clone.Parent = player.Backpack |
49 | game.Players.PlayerAdded:Connect( function (player) |
51 | player.CharacterAdded:Connect( function (character) |
52 | character.Humanoid.Died:Connect( function () |
54 | player.Team = game.Teams.Lobby |
61 | if ((#game.Players:GetPlayers()) > = 2 and not matchIsInProgress) then |
62 | print ( "there are enough players, start the match" ) |
67 | matchIsInProgress = true |
68 | givePlayersRandomTeams() |
70 | spawnTeam(game.Teams.Knights) |
71 | spawnTeam(game.Teams.Raiders) |
Hope you understand I hope to here from you guys soon!