I’m Trying to make a Donation Board Script But I Don’t want Myself in the leaderboard
How can I Make it
local DonateAmounts = {
5,
10,
50,
100,
500,
1000
}
local DonationIDs = {
1298214298,
1298214869,
1298215285,
1298220710,
1298221269,
1298221625
}
local CashProductIDs =
{
[1334471867] = 10,
[1334455568] = 50,
[1334462068] = 100,
[1334466040] = 500,
}
local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local Donators = DataStoreService:GetOrderedDataStore("Donators")
game.Players.ChildAdded:Connect(function(Player)
for i, amount in pairs(DonateAmounts) do
local donateButton = script:WaitForChild("DonateButton"):Clone()
donateButton.Text = amount .. " Robux"
donateButton.Parent = Player:WaitForChild("PlayerGui"):WaitForChild("Screen").DonationFrame.Donate.DonateList
end
game.ReplicatedStorage.DonateRE.OnServerEvent:Connect(function(Player, button)
local amount = string.gsub(button.Text, " Robux", "")
local id = DonationIDs[table.find(DonateAmounts, tonumber(amount))]
MarketplaceService:PromptProductPurchase(Player, id)
end)
MarketplaceService.ProcessReceipt = function(purchaseInfo)
spawn(function()
local PlayerPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)
if not PlayerPurchased then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
for productID, coinsGiven in pairs(CashProductIDs) do
if purchaseInfo.ProductId == productID then
PlayerPurchased.PlayerData.Cash.Value = PlayerPurchased.PlayerData.Cash.Value + coinsGiven
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end)
local amount = MarketplaceService:GetProductInfo(purchaseInfo.ProductId, Enum.InfoType.Product).PriceInRobux
local success, err = pcall(function()
local totalDonated = Donators:GetAsync(purchaseInfo.PlayerId) or 0
Donators:SetAsync(purchaseInfo.PlayerId, totalDonated + amount)
end)
return success and Enum.ProductPurchaseDecision.PurchaseGranted or Enum.ProductPurchaseDecision.NotProcessedYet
end
spawn(function()
while task.wait(5) do
for i, child in pairs(Player:WaitForChild("PlayerGui"):WaitForChild("Screen").DonationFrame.Leaderboard.LeaderboardList:GetChildren()) do
if child:IsA("Frame") then
child:Destroy()
end
end
local pages = Donators:GetSortedAsync(false, 100)
local top = pages:GetCurrentPage()
for rank, data in ipairs(top) do
local username = game.Players:GetNameFromUserIdAsync(data.key)
local donated = data.value
local leaderboardFrame = script.LeaderboardFrame:Clone()
leaderboardFrame.Rank.Text = "#" .. rank
leaderboardFrame.Username.Text = username
leaderboardFrame.Amount.Text = donated
leaderboardFrame.Parent = Player:WaitForChild("PlayerGui"):WaitForChild("Screen").DonationFrame.Leaderboard.LeaderboardList
end
end
end)
end)