Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local OrderedDataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Saved")
- local Holder = script.Parent.Frame.ScrollingFrame
- local CurrencyName = "Dinero"
- local Prefix = "Dinero "
- local List = 10
- local RefreshingTime = 10
- function Main ()
- local Success, Error = pcall(function()
- local Pages = OrderedDataStore:GetSortedAsync(false, List)
- local Data = Pages:GetCurrentPage()
- for pos, v in ipairs(Data)do
- local PlayerName = tostring(v.key)
- local Data = tostring(v.value)
- local NewFrame = script.Frame:Clone()
- NewFrame.PlayerPos.Text = pos .. ". " .. PlayerName
- NewFrame.PlayerCurrency.Text = Prefix .. Data
- NewFrame.Parent = Holder
- end
- end)
- if not Success and Error then
- error(Error)
- end
- end
- while true do
- for _, Player in pairs(game.Players:GetPlayers())do
- local PlayerValue = Player.leaderstats[CurrencyName]
- OrderedDataStore:SetAsync(Player.Name, PlayerValue.Value)
- end
- for _, v in pairs(Holder:GetChildren())do
- if v.Name == "Frame" and v:IsA("Frame") then
- v:Destroy()
- end
- end
- Main()
- wait(RefreshingTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement