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

Argument 1 missing or nil on LeaderBoard?

Asked by
3F1VE 257 Moderation Voter
2 years ago

Heres the code :

local datastore = game:GetService("DataStoreService"):GetOrderedDataStore("Time")

local function UpdLB()
local success, errormessage = pcall(function()
        local data = datastore:GetSortedAsync(false,100)
        local timepage = data:GetCurrentPage()
        for rank,data in ipairs(timepage) do
            local username = game.Players:GetUserIdFromNameAsync(data.Key)
            local name = username
            local timee = data.Value
            local isonlb = false
            for i, v in pairs(workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()) do
                if v.User.Text == name then
                    isonlb = true
                    break
                end
            end
            if timee and isonlb == false then
                local newlbfrm = game.ReplicatedStorage:WaitForChild("PlaceHolder"):Clone()
                newlbfrm.User.Text = name
                newlbfrm.Time.Text = timee
                newlbfrm.Number.Text = "#"..rank
                newlbfrm.Position = UDim2.new(0,0, newlbfrm.Position.Y.Scale + (.08 * #workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()),0)
                newlbfrm.Parent = workspace.LB.SurfaceGui.Container.ScrollingFrame
                end
        end
    end)
    if not success then
        warn(errormessage)
    end
end 

while wait(10) do
    for _, frame in pairs(workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()) do
        frame:Destroy()
    end
    UpdLB()
    print("updated")
end

It warns me in the output "Argument 1 missing or nil" I scanned it 3 times and nothing.

0
do you know which line errored NGC4637 602 — 2y
0
No it just returns "Argument 1 missing or nil" in output and when I click on it, it takes me to like 29. 3F1VE 257 — 2y
0
Line* 3F1VE 257 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

try

local datastore = game:GetService("DataStoreService"):GetOrderedDataStore("Time")

local function UpdLB()
local success, errormessage = pcall(
        local data = datastore:GetSortedAsync(false,100)
        local timepage = data:GetCurrentPage()
        for rank,data in ipairs(timepage) do
            local username = game.Players:GetUserIdFromNameAsync(data.Key)
            local name = username
            local timee = data.Value
            local isonlb = false
            for i, v in pairs(workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()) do
                if v.User.Text == name then
                    isonlb = true
                    break
                end
            end
            if timee and isonlb == false then
                local newlbfrm = game.ReplicatedStorage:WaitForChild("PlaceHolder"):Clone()
                newlbfrm.User.Text = name
                newlbfrm.Time.Text = timee
                newlbfrm.Number.Text = "#"..rank
                newlbfrm.Position = UDim2.new(0,0, newlbfrm.Position.Y.Scale + (.08 * #workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()),0)
                newlbfrm.Parent = workspace.LB.SurfaceGui.Container.ScrollingFrame
                end
        end
    end)
    if not success then
        warn(errormessage)
    end
end 

while wait(10) do
    for _, frame in pairs(workspace.LB.SurfaceGui.Container.ScrollingFrame:GetChildren()) do
        frame:Destroy()
    end
    UpdLB()
    print("updated")
end
0
What changed? 3F1VE 257 — 2y
0
And it prints nothing. 3F1VE 257 — 2y
0
I think im gonna have to rewrite your script is that okay? WINDOWS10XPRO 438 — 2y
Ad

Answer this question