so i was trying to make a global leaderboard and it went in the wrong directin it said this in the output but idk what it means
"Did you forget a colon? The first argument of member function GetNameFromUserIdAsync must be an Object"
ok the script is
for i = 1, 10 do
local Sam = script.Sample:Clone()
Sam.Name = i
Sam.Parent = script.Parent.Frame.ScrollingFrame
Sam.UserPos.Text = "[" .. tostring(i) .. "]"
Sam.Score.Text = "Nil"
Sam.Username.Text = ""
Sam.LayoutOrder = i
script.Parent.Frame.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 50 * i)
end
function UpdateGui()
for i, v in pairs(game.Players:GetChildren()) do
local Data = 1 -- This is your score.
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Cash")
DataStore:SetAsync(v.UserId, Data)
end
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Cash")
local Pages = DataStore:GetSortedAsync(false, 10)
local Data = Pages:GetCurrentPage()
for k, v in pairs(Data) do
if tonumber(v.key) >= 1 then
local Frame = script.Parent.Frame.ScrollingFrame:FindFirstChild(tostring(k))
if Frame then
Frame.Username.Text = game.Players.GetNameFromUserIdAsync(v.key)
Frame.Score.Text = tostring(v.Value)
end
end
end
end
while true do
UpdateGui()
wait(2)
end
plz help me
if you want to help me further, ask me for the model so i can give it to u
