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

Why will nothing happen? [ANSWERED]

Asked by 9 years ago

I'm trying to make it so when a player dies the Dead Value adds 1 and the Alive value subtracts 1. Here is the script:

function onHumanoidDied(humanoid, player)
    game.Workspace.Dead.Value = game.Workspace.Dead.Value + 1
    game.Workspace.Alive.Value = game.Workspace.Alive.Value - 1
end

What is wrong with it? If anyone would help I would be grateful! Edit: I figured it out.

0
Is onHumanoidDied connected to the Died event? IXLKIDDO 110 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I figured it out. This is what I ended up with:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
            char.Humanoid.Died:connect(function(died)
Dead.Value = Dead.Value + 1
Alive.Value = Alive.Value - 1
            end)
        end)
    end)
Ad

Answer this question