Hi there Devs! So I am trying to make a Donation Leaderboard. I have seen a tutorial for it and followed everything. It did not work.
So first off:
What am I trying to achieve?
I am trying to make a donate leaderboard so basically when a person donates, they get up on the leaderboard. This leaderboard includes the different donate buttons with different values
Second:
How is my leaderboard oraganized and what scripts am I using?
(EVERY BUTTON HAS THIS SCRIPT WITH A DIFFERENT DEVELOPER ID)
> local ReplicatedStorage = game:GetService("ReplicatedStorage")
> local remoteEvent = ReplicatedStorage:WaitForChild("Purchase")
> local MarketplaceService = game:GetService("MarketplaceService")
> local player = game.Players.LocalPlayer
>
> local productID = 0
>
> player.PlayerGui.DonationGui["5"].Textbutton.MouseButton1Click:Connect(function()
> MarketplaceService:PromptProductPurchase(player, productID)
> end)
(The script i’m using for the above screenshot)
> local lbData = game:GetService("DataStoreService"):GetOrderedDataStore("Board")
>
> function AddCommas(num)
>
> return tostring(math.floor(num)):reverse():gsub("(%d%d%d)","%1,"):gsub(",(%-?)$","%1"):reverse()
>
> end
>
> function Update()
>
> local frames = workspace.Leaderboard.SurfaceGui.ScrollingFrame:GetChildren()
>
> for v,v in pairs(frames) do
>
> if v:IsA("Frame") then
>
> v:Destroy()
>
> end
>
> end
>
> for _,plr in next, game:GetService("Players"):GetPlayers() do
>
> pcall(function()
>
> ibData:UpdateAsync(plr.UserId, function() return plr:FindFirstChild("leaderstats"):WaitForChild("Donation").Value end)
>
> end)
>
> end
>
> local data = lbData:GetSortedAsync(false,10)
>
> local page = data:GetCurrentPage()
>
> for rank, info in next, page do
>
> local frame = script.Parent.Sample:Clone()
>
> frame.Visible = true
>
> local plrName = game:GetService("Players"):GetNameFromUserIdAsync(info.key)
>
> frame:WaitForChild("Place").Text = "#"..rank
>
> if rank == 1 then
>
> print("gold")
>
> frame.BackgroundColor3 = Color3.new(0.854902, 0.647059, 0.12549)
>
> elseif rank == 2 then
>
> print("silver")
>
> frame.BackgroundColor3 = Color3.new(0.752941, 0.752941, 0.752941)
>
> elseif rank == 3 then
>
> print("bronze")
>
> frame.BackgroundColor3 = Color3.new(0.690196, 0.552941, 0.341176)
>
> else
>
> print("white")
>
> frame.BackgroundColor3 = Color3.new(1, 1, 1)
>
> end
>
> frame.Username.Text = plrName
>
> frame.Value.Text = AddCommas(info.value)
>
> frame.Visible = true
>
> frame.Parent = workspace.Leaderboard.SurfaceGui.ScrollingFrame
>
> end
>
> end
>
> while true do
>
> Update()
>
> wait(15)
>
> end
(This script is supposingly used for updating the leaderboard)
The Donate Buttons are in ScreenGUIs but they are Adorneed with the ‘Shop’ part
Any help please??