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

How do I access the leaderboard and change the deaths in a function?

Asked by 10 years ago

I made a script that changes someone's team if they are in a group and resets them so that they spawn in the right place but it adds a wipeout to their leaderboard. How do I access the leaderboard and subtract 1 in the function after i reset them?

1 answer

Log in to vote
0
Answered by 10 years ago

You do not access the leaderboard, you create the leaderboard.

Leaderboards are made by creating an IntValue named "leaderstats" inside of the player, then inserting all other stats, such as NumberValues for Kills and Deaths inside of the leaderstats.

You can figure that out yourself. As to changing the Deaths when the Player dies, you can use the .Died event.

function humanoidDied(humanoid)
    local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
    if player ~= nil then
        player.Deaths.Value = player.Deaths.Value - 1
    end
end

for i,v in pairs(game.Players:GetChildren()) do --Fires the humanoidDied function for each player
    v.Character.Humanoid.Died:connect(humanoidDied)
end

0
No, I don't need to create it, it is already there, I need to access the scripted leaderboard in another script. PureDefiance 20 — 10y
0
Then you should probably insert the script you are talking about. SlickPwner 534 — 10y
Ad

Answer this question