Basically, in this script, everytime a death occurs in a certain team, the teams death value will increase by 1. This is represenetd with the RedDeaths and BlueDeaths variables below, being 2 seperate teams. RedDeaths being the IntValue of deaths of the red team and same for blue, just with a different name. Everything seems to work, except, when a player dies on one of these teams, it prints both if statements, as if the player were on both teams at once when he/she died. For example, if i was on the blue team and i died, it would print both that i died on the red and blue team. Does anyone know how i could fix this error in my script? Thanks for your time! ;)
Script:
local Player = game.Players.LocalPlayer
local humanoid = Player.Character:findFirstChild("Humanoid")
local RedTeamPlayers = game.Teams.Red:GetPlayers()
local BlueTeamPlayers = game.Teams.Blue:GetPlayers()
local RedDeaths = game.Workspace.GameScript.DeathMatchMode.Config.RedDeaths
local BlueDeaths = game.Workspace.GameScript.DeathMatchMode.Config.BlueDeaths
function DiedX_X(BlueTeamPlayers)
BlueDeaths.Value = BlueDeaths.Value + 1
end
humanoid.Died:connect(DiedX_X)
if BlueDeaths.Value == 1 then
print('1 Blue Death')
end
function DiedX_X(RedTeamPlayers)
RedDeaths.Value = RedDeaths.Value + 1
end
humanoid.Died:connect(DiedX_X)
if RedDeaths.Value == 1 then
print('1 Red Death')
end

5 comments
It may be because both of the function names are "DiedX_X" so it's calling both functions.
Mayk728 That is true, but i need two separate DiedX_X functions to differentiate the death of a Blue Team Player and a Red Team Player
Have you tried changing one of the "DiedX_X"'s to a different name? I'm most certain that's the error
Okay i just tested and that wasn't the problem. Sorry bout that.
You're fine ;)