Coudn't seem to find out what was wrong with this one. The only error it gives me is " Attempt to connect failed: Passed value is not a function", but im not sure that error refers to this script. Would anyone happen to know just how to fix this script? Thanks! ;)
local RedTeamDeaths = game.Workspace.Config.RedDeaths game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function(Died) if Player.TeamColor == BrickColor.Red() then RedTeamDeaths.Value = RedTeamDeaths.Value + 1 end end) end) end)
Remove Died
inside of the parentheses on line 6. The Died event doesn't pass any arguments.
"Red()" isn't a function. Try to remove the () at the end of it, so the code could be like
local RedTeamDeaths = game.Workspace.Config.RedDeaths game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function(Died) if Player.TeamColor == BrickColor.Red then RedTeamDeaths.Value = RedTeamDeaths.Value + 1 end end) end) end)
If you're using something like "'Bright red" then you would have to do something like
local RedTeamDeaths = game.Workspace.Config.RedDeaths game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function(Died) if Player.TeamColor == BrickColor["Bright red"] then RedTeamDeaths.Value = RedTeamDeaths.Value + 1 end end) end) end)
I haven't tried this code out, so if it doesn't work tell me and I can fix it.