I need the script you posted in your original message
for i = 1,10 do
local Sam = script.Sample:clone()
Sam.Name = i
Sam.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
Sam.UserPos.Text = “[”… tostring(i) … “]”
Sam.Money.Text = “Nil”
Sam.UserName.Text = “”
Sam.Layoutorder = i
script.Parent.SurfaceGui.Frame.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,50*i)
end
function UpdateGui()
for i,v in pairs(game.Players:GetChilderen()) do
local Data = 1
local DateStore = game:GetService(“DataStoreService”):GetOrderDataStore(“MoneyX1”)
DateStore:SetAsync(v.UserId,Data)
end
local DateStore = game:GetService(“DataStoreService”):GetOrderDataStore(“MoneyX1”)
local Pages = DateStore:GetSortedAsync(false,10)
local Data = Pages:GetCurrentPage()
for k,v in pairs(Data) do
if tonumber(v.key) >= 1 then
local Frame = script.Parent.SurfaceGui.Frame.ScrollingFrame:FindFirstChild(tostring(k))
if Frame then
Frame.UserName.Text = game.Players:GetNameFromUserIdAsync(v.key)
Frame.Money.Text = tostring(v.Value)
end
end
end
end
while true do
UpdateGui()
wait(2)
end
But that’s the old script, I need updated version so I can see what are you doing wrong
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("MoneyX1")
for i = 1,10 do
local Sam = script.Sample:Clone()
Sam.Name = i
Sam.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
Sam.UserPos.Text = "[".. tostring(i) .. "]"
Sam.Money.Text = "Nil"
Sam.UserName.Text = ""
Sam.LayoutOrder = i
script.Parent.SurfaceGui.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
DataStore:SetAsync(v.UserId, Data)
end
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.SurfaceGui.Frame.ScrollingFrame:FindFirstChild(tostring(k))
if Frame then
Frame.UserName.Text = game.Players:GetNameFromUserIdAsync(v.key)
Frame.Money.Text = tostring(v.value)
end
end
end
end
while true do
UpdateGui()
wait(60)
end
The script above should display 1 next to your name since you’re saving value “1” as everyone’s data
so what do i do then ? (30characters)
In case you want a money leaderboard then you should replace local Data = 1
with local Data = v:WaitForChild("leaderstats").Money.Value
now i have this still doesnt work
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("MoneyX1")
for i = 1,10 do
local Sam = script.Sample:Clone()
Sam.Name = i
Sam.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
Sam.UserPos.Text = "[".. tostring(i) .. "]"
Sam.Money.Text = "Nil"
Sam.UserName.Text = ""
Sam.LayoutOrder = i
script.Parent.SurfaceGui.Frame.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,50*i)
end
function UpdateGui()
for i,v in pairs(game.Players:GetChildren()) do
local Data = v:WaitForChild("leaderstats").Money.Value
DataStore:SetAsync(v.UserId, Data)
end
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.SurfaceGui.Frame.ScrollingFrame:FindFirstChild(tostring(k))
if Frame then
Frame.UserName.Text = game.Players:GetNameFromUserIdAsync(v.key)
Frame.Money.Text = tostring(v.value)
end
end
end
end
while true do
UpdateGui()
wait(60)
end
f u can fix this u are a legend
Any errors?
30 Characters
this shows up
Infinite yield possible on ‘Players.rohanspeeltgames:WaitForChild(“Character”)’
what if i did
‘Players.rohanspeeltgames:WaitForChild(“Player”)’
I don’t know what are you doing wrong, but this all works as expected for me.
Edit: The error above is not related to your leaderboard script.
but i have so many names for 1 currency money,Money,Cash,levc
i wanna make that script easyer but i cant really do that
What number should be displayed on the leaderboard and what value is being displayed on the leaderboard?
it should be the number of money you have
edit just a 1
But what value are you seeing on there?
Edit: Wait 60 seconds until it updates, then you should see the right value I guess
Use RunService.Heartbeat instead of while loop.
I’m feel like I’m not really helping you