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

Leaderboard isn't working, instead of a name it says "value"?

Asked by 8 years ago
Edited 8 years ago

I made a leaderboard in which worked perfectly, until I did what wiki says to make it save whenever a player leaves a game. However, "Platinum" isn't showing up, instead it says "Value".

local DataStore = game:GetService("DataStoreService")
local dD = DataStore:GetDataStore("dD")
local mM = 25 --ignore this.

game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder",player)
    leader.Name = "leaderstats"

    local Experience = Instance.new('IntValue', leader)
    Experience.Name = 'Experience'
    Experience.Value = dD:GetAsync(player.UserId) or 0
    dD:SetAsync(player.UserId, Experience.Value)
    Experience.Changed:connect(function()
        dD1:SetAsync(player.UserId, Experience.Value)
    end)

    local Credits = Instance.new('IntValue', leader)
    Credits.Name = 'Credits'
    Credits.Value = dD:GetAsync(player.UserId) or 0
    dD:SetAsync(player.UserId, Credits.Value)
    Credits.Changed:connect(function()
        dD:SetAsync(player.UserId, Credits.Value)
    end)

    local Mastery = Instance.new('IntValue', leader)
    Mastery.Name = 'Mastery'
    Mastery.Value = dD:GetAsync(player.UserId) or 1
    dD:SetAsync(player.UserId, Mastery.Value)
    Mastery.Changed:connect(function()
        dD:SetAsync(player.UserId, Mastery.Value)
    end)

    local Platinum = Instance.new('IntValue', leader)
    Platinum.Name = 'Platinum'
    Platinum.Value = dD:GetAsync(player.UserId) or 0
    dD:SetAsync(player.UserId, Platinum.Value)
    Platinum.Changed:connect(function()
        dD:SetAsync(player.UserId, Platinum.Value)
    end)



end)

game.Players.PlayerRemoving:connect(function(player)
    print("SD")
dD:SetAsync(player.UserId, player.leaderstats.Experience.Value, player.leaderstats.Credits.Value, player.leaderstats.Mastery.Value, player.leaderstats.Platinum.Value)
end)

Answer this question