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

Why will nothing happen? [ANSWERED]

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.

1 comment

0

Is onHumanoidDied connected to the Died event?

1 answer

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)

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