Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script to add scores after a player dies isn't functioning properly, why not?

Players = game:GetService("Players")
Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")
        Humanoid.Died:connect(function()
            if Humanoid.TeamColor == "Bright blue" then
    game.Workspace.RedScore.Value = game.Workspace.RedScore.Value + 1
else
    game.Workspace.BlueScore.Value = game.Workspace.BlueScore.Value + 1
end
        end)
    end)
end)

I made this script so that whenever a player dies, it checks their team, and if it's the blue team, a number value in workspace will go up by 1, and if it's the red team, a different number value in workspace will go up by 1. I have this script in serverscriptservice and I have tried different ways, one time it worked but only the red team score increased, and changing line 6 to

if Humanoid.TeamColor == BrickColor.new("Bright blue") then

doesn't work either :/ at this point it doesn't work at all and shows me no errors in the output, anyone know why?

1 comment

1

if Humanoid.Parent.Parent.Team.Name = "team name" then

1 answer

✓ Accepted answer

Hello again :)

Explanation

There is no such property Humanoid.TeamColor. You may have confused this with Player.TeamColor. I also edited my answer on the other post to include this.

Solution

Just change line 6 to:

if Player.TeamColor == BrickColor.new("Bright blue") then

This discussion is preserved as it was. New answers, comments, and votes are closed.