OUTPUT:
v.Value = nil v.key = 266839***
Why is "v.Value" nil? if I'm using "DataStore: GetAsync (UserId, Data)
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Score2") for i = 1, 10 do local sam = script.Frame:Clone() sam.Name = i sam.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame sam.PlayerPos.Text = tostring(i) .. ". " .. "Player" .. i sam.PlayerCurrency.Text = "Nil" sam.LayoutOrder = 1 script.Parent.SurfaceGui.Frame.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 50 * i) end function UpdateGui () local Pages = DataStore:GetSortedAsync(false, 10) local Data = Pages:GetCurrentPage() for k, v in pairs(Data)do print(v.Value, v.key) if tonumber(v.key) >= 1 then local Frame = script.Parent.SurfaceGui.Frame.ScrollingFrame:FindFirstChild(tostring(k)) if Frame then Frame.PlayerPos.Text = game.Players:GetNameFromUserIdAsync(v.key) Frame.PlayerCurrency.Text = tostring(v.Value) end end end end while true do for i, v in pairs(game.Players:GetPlayers())do if v then local Data = v.leaderstats.Nivel DataStore:SetAsync(v.UserId, Data.Value) end end UpdateGui() wait(20) end
I'm doing a Top Leaderboard of the level the player
It is a Normal Script within the Part (Surface Gui)