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

Why isn't this died event part oof a leaderboard script working??

Asked by 9 years ago
game.Players.Character.Humanoid.Died:connect(
    function(hit)
                  hit = Humanoid:FindFirstChild("")
         hit.Name.Points.Value = hit.Name.Points.Value - 1
    end
)

1 answer

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

You misused the Died event. Also, you didn't properly access a Player's leaderstats which is a direct descendant of the Player. The script below was pulled straight from the Wiki. Any questions? Drop a comment below!

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            player.leaderstats.Points.Value = player.leaderstats.Points.Value - 1
        end)
    end)
end)
Ad

Answer this question