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

how to set maxvalue leaderstats to 1 billion?

Asked by 3 years ago
Edited 3 years ago

I'm trying to limit but it looks like the leaderstats with the name of rebirths is limiting at 10

https://prnt.sc/122ji7i

local PlayerStatsDS = game:GetService("DataStoreService"):GetDataStore("Player_StatsOL2")

game.Players.PlayerAdded:Connect(function(NP)

    local Key = "PDS-".. NP.UserId

    local GetSave = PlayerStatsDS:GetAsync(Key)

    local PSF = Instance.new("Folder", NP)
    PSF.Name = "leaderstats"

    local StatsFolder = script.Stats

    for _, S in pairs(StatsFolder:GetChildren()) do
        local NS = Instance.new(S.ClassName, PSF)
        NS.Name = S.Name
        NS.Value = S.Value
    end

    local timeplayed = PSF:WaitForChild("Time Played")

    spawn(function()
        while true do
            wait(1)
            timeplayed.Value = timeplayed.Value + 1
        end
    end)

    if GetSave then
        for n, Stat in pairs(PSF:GetChildren()) do
            Stat.Value = GetSave[n]
        end
    else
        local STS = {}
        for _, Stat in pairs(StatsFolder:GetChildren()) do
            table.insert(STS, Stat.Value)
        end
        PlayerStatsDS:SetAsync(Key, STS)
    end
end)

game.Players.PlayerRemoving:connect(function(OP)

    local Key = "PDS-".. OP.UserId

    local StatsFolder = OP.leaderstats

    local STS = {}
    for _, Stat in pairs(StatsFolder:GetChildren()) do
        table.insert(STS, Stat.Value)
    end
    PlayerStatsDS:SetAsync(Key, STS)
end)
0
What type of value are you instancing to the leaderstats folder? JJayxx_123 1 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Use a DoubleConstrainedValue as the class for the stat you will be instancing into the leaderstats folder. With this value, you can change the MinValue and the MaxValue of the stat.

For example:

local value = Instance.new("DoubleConstrainedValue",PSF)
value.Name = "" -- Put name here
value.MinValue = 1 -- Min Value (1)
value.MaxValue = 1000000000 -- Max Value (1 Billion)
Ad

Answer this question