INFORMATION This is my leaderboard script not leaderstats The error is the tittle This is my first time seeing this error

local suffixes = {
	K = 4,
	M = 7,
	B = 10,
	T = 13,
	Qa = 16,
	Q = 19,
	S = 22, 
	Sp = 25,
	O = 28,
	N = 31,
	D = 34,
	U = 37,
	Du = 40,
	Tr = 43,
	Qd = 46,
	Qid = 49,
	Sd = 52,
	Spd = 55,
	Oc = 58,
	No = 61,
	V = 64,
	Uv = 67,
	Dv = 70,
	Tv = 73,
	Qv = 76,
	Qi = 79,}
local function format(val)
	for i=1, #suffixes do
		if tonumber(val) < 10^(i*3) then
			return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
		end
	end
end

local TimeODS = game:GetService("DataStoreService"):GetOrderedDataStore("Normalslots2")
local function Handler()
	local Success, Err = pcall(function()
		local Data = TimeODS:GetSortedAsync(false, 15)
		local Time = Data:GetCurrentPage()
		for Rank, Data in ipairs(Time) do
			local Name = Data.key
			local Time = Data.value
			local NewObj = game.ReplicatedStorage.Gui.lbFrame:Clone()
			NewObj.Player.Text = Name
			NewObj.Stats.Text = format(Time)
			NewObj.Rank.Text = "#"..Rank
			NewObj.Position = UDim2.new(0, 0, NewObj.Position.Y.Scale + (0.08 * #game.Workspace.Leaderboards.TimeLb.Handler.lbGUI.Holder:GetChildren()), 0)
			NewObj.Parent = game.Workspace.Leaderboards.TimeLb.Handler.lbGUI.Holder.Scroll
		end
	end)
	if not Success then
		error(Err)
	end
end
while true do
	for _,Player in pairs(game.Players:GetPlayers()) do
		TimeODS:SetAsync(Player.Name, Player.leaderstats2.TimePlayed.Value)
	end
	for _,v in pairs(game.Workspace.Leaderboards.PrestigeLb.Handler.lbGUI.Holder:GetChildren()) do
		if v.Name == "lbFrame" then
			v:Destroy()
		end
	end
	Handler()
	wait(20)
end

3 comments

0

Which line?

0

53 and 65

1

Please post the line where the original error occured, not the line where pcall threw the error. On a sidenote your pcall is useless since pcall is supposed to protect the method from erroring, yet you just happily throw the error again after catching it.