Hi guys,
I can’t figure out why this code stops at “c”. I have confirmed that the datastore does have saved data in it. So not sure why it just stops there. Any help would be great thanks.
Code:
local DataStoreService = game:GetService("DataStoreService")
local QuestData = DataStoreService:GetOrderedDataStore("QUESTLB01")
local abbreviations = {
K = 4,
M = 7,
B = 10,
T = 13,
Qa = 16,
Qi = 19,
Sx = 22,
Sp = 25,
Oc = 28,
No = 31,
Dc = 34
}
local function GetQuest()
local Success, Err = pcall(function()
print("a")
local Data = QuestData:GetSortedAsync(false, 100)
print("b")
local Page = Data:GetCurrentPage()
print("c")
for rank, data in ipairs(Page) do
print("d")
local Name = data.key
print("e")
local Amount = data.value
print("f")
local text = tostring(math.floor(Amount))
print("g")
local chosenabbreviation
for i,v in pairs(abbreviations) do
if #text >= v and #text < (v + 3) then
chosenabbreviation = i
break
end
end
print("h")
if chosenabbreviation then
local digits = abbreviations[chosenabbreviation]
local rounded = math.floor(Amount / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text = string.format("%.1f", rounded / 10 ^ (digits - 1))..chosenabbreviation
else
text = Amount
end
print("i")
local NewObj = game.ReplicatedStorage.LBFrame:Clone()
NewObj.Player.Text = Name
NewObj.Amount.Text = text
NewObj.Rank.Text = "#"..rank
NewObj.Parent = game.Workspace.Leaderboard_Quests.GUI.Frame
print("j")
end
end)
if not Success then
error(Err)
end
end
while true do
wait(30)
local frames = game.Workspace.Leaderboard_Quests.GUI.Frame:GetChildren()
for i,v in pairs(frames) do
if v:IsA("Frame") then
v:Destroy()`Preformatted text`
end
end
wait()
GetQuest()
print("updating quest LB")
end