Why is "v.Value" nil? if I'm using "DataStore: GetAsync (UserId, Data)?

OUTPUT:

v.Value = nil v.key = 266839***

  • DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 266839***

Why is “v.Value” nil? if I’m using "DataStore: GetAsync (UserId, Data)


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

The reason why you’re probably getting an error is because you capitalized the v in value. Try using v.value instead of v.Value and let me know what happens.

Make sure you don’t use SetAsync too much. DataStore has limits on how many times you can call SetAsync within an x amount of seconds. I would recommend you read this article to prevent your requests from throttling.

1 Like