How do I add a point to one team when a member of the other dies?
This is the code:
1 | game:GetService( 'Players' ).PlayerAdded:connect( function (player) |
2 | player.CharacterAdded:connect( function (character) |
3 | character:WaitForChild( "Humanoid" ).Died:connect( function () |
4 | print (player.Name,player.Team,player.TeamColor) |
6 | if player.Team = = "Red" then |
7 | _G.claimed = _G.claimed + 1 |
When I reset the game outputs my player name and my team/team brick colour as it's supposed to (Line 4).
The team name it outputs is "Red".
The if statement says if the player is on red add a point. (Of course this only happens when the player dies)
My problem is that it for some reason doesn't add the point. If I remove the if statement it works but it'll give the point even if blue dies (I only want to add the point if red dies).
How can I make this work?