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

Leaderboard not showing kills and deaths?

Asked by 4 years ago

This problem has been happening since the last Roblox update. For most players in the game, the leader board for kills and deaths is not working for everyone on the server, can I get some help with this? Feedback is appreciated. Screenshot - https://cdn.discordapp.com/attachments/573328058770259969/642178848322224138/unknown.png

local Players = game.Players

local Template = Instance.new 'BoolValue'
Template.Name = 'leaderstats'

Instance.new('IntValue', Template).Name = "Kills"
Instance.new('IntValue', Template).Name = "Deaths"


Players.PlayerAdded:connect(function(Player)
    wait(1)
    local Stats = Template:Clone()
    Stats.Parent = Player
    local Deaths = Stats.Deaths
    Player.CharacterAdded:connect(function(Character)
        Deaths.Value = Deaths.Value + 1
        local Humanoid = Character:FindFirstChild "Humanoid"
        if Humanoid then
            Humanoid.Died:connect(function()
                for i, Child in pairs(Humanoid:GetChildren()) do
                    if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
                        local Killer = Child.Value
                        if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
                            local Kills = Killer.leaderstats.Kills
                            Kills.Value = Kills.Value + 1
                        end
                        return -- Only one player can get a KO for killing a player. Not 2, not 3. Only one.
                    end
                end
            end)
        end
    end)
end)
-- Coded by JulienDethurens using gedit.
0
This is because of FE. Try to change the value via a RemoteEvent. G0ZZEN 17 — 4y

Answer this question