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

How do I give the player who killed 10points?

Asked by 6 years ago
Edited 6 years ago

I have leaderboard and I want to give the killer some points for killing someone.

leaderboard = game.Players.LocalPlayer.leaderstats

points = leaderboard.points

so what do i do now

0
Already wrong, localplayer cannot be accessed from the server User#20388 0 — 6y
0
oof Theroofypidgeot 21 — 6y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
6 years ago

I'll give you the nice side of me and say that you did try.

Tag the player on hit.

Then, when a player dies, connect to a humanoid.Died signal to give the player points.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local humanoid;
        repeat wait()
            humanoid = character:FindFirstChildOfClass('Humanoid')
        until humanoid
        humanoid.Died:connect(function(died)
            local playerwhoKilled = character:FindFirstChild('TaggedByPerson', true)
            game.Players[playerwhoKilled.Value].leaderstats.Points.Value = game.Players[playerwhoKilled.Value].leaderstats.Points.Value+10
        end)
    end)
end)
Ad

Answer this question