Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Originally written by me, rewritten by @Feahren
- local MarketPlaceService = game:GetService("MarketplaceService")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ServerStorage = game:GetService("ServerStorage")
- local Players = game:GetService("Players")
- local RobuxDonationData = game:GetService("DataStoreService"):GetOrderedDataStore("DonationData")
- local RobuxDonateEvent = ReplicatedStorage:WaitForChild("EventsFolder"):WaitForChild("RobuxDonateEvent")
- local DataPageRequest = 15
- local Leaderboard = workspace:WaitForChild("GlobalLeaderboard")
- local BoardGUI = Leaderboard:WaitForChild("lbGUI")
- local BoardSlots = BoardGUI:WaitForChild("Holder")
- local function UpdateLeaderBoard()
- print("Updating LeaderBoard...")
- local Response = RobuxDonationData:GetSortedAsync(false, DataPageRequest)
- local RobuxDataPage = Response:GetCurrentPage()
- for _, RobuxData in ipairs(RobuxDataPage) do
- local Username = Players:GetNameFromUserIdAsync(tonumber(RobuxData.key))
- print(Username)
- local TotalDonated = RobuxData.value
- local IsOnLeaderboard = false
- for _, Slot in pairs(BoardSlots:GetChildren()) do
- if (Slot.Player.Text == Username) then
- IsOnLeaderboard = true
- print("Player Is On LeaderBoard? "..IsOnLeaderboard.."!")
- break
- else
- print("Player Is On LeaderBoard? "..IsOnLeaderboard.."!")
- end
- end
- if (TotalDonated and not IsOnLeaderboard) then
- local Slot = ServerStorage:WaitForChild("lbFrame"):Clone()
- Slot.Player.Text = Username
- Slot.Amount.Text = tostring(TotalDonated)
- Slot.Position = UDim2.new(0, 0, (Slot.Position.Y.Scale + (0.08 * #BoardSlots:GetChildren())), 0)
- Slot.Parent = BoardSlots
- print("Slot Cloned")
- end
- end
- end
- local function ProcessReceipt(ReceiptInfo)
- local Completed = Enum.ProductPurchaseDecision.PurchaseGranted
- local NotProcessed = Enum.ProductPurchaseDecision.NotProcessedYet
- local Player = game:GetService("Players"):GetPlayerByUserId(ReceiptInfo.PlayerId)
- if (Player) then
- spawn(function()
- repeat wait() until Completed
- RobuxDonationData:IncrementAsync(ReceiptInfo.PlayerId, ReceiptInfo.CurrencySpent)
- BoardSlots:ClearAllChildren()
- UpdateLeaderBoard() -- Error Here
- end)
- return Completed
- end
- return NotProcessed
- end
- MarketPlaceService.ProcessReceipt = ProcessReceipt
Advertisement
Add Comment
Please, Sign In to add comment