Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
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
if Humanoid.Parent.Parent.Team.Name = "team name" then abnotaddable 920 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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
Ad

Answer this question