Note: Go to Post #7 for update on script!
I was trying to make a donation list game where you can donate to others like Pls Donate. But, it didn’t work as expected. I tried to search over the web but nothing helped me figure it out. I’d appreciate if you would help me out on this.
If you want to know what’s happening when I claim a board, nothing happens(no errors)
Here are my scripts:
Claiming the Board script:
script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
if plr then
if script.Parent and script.Parent.Parent and script.Parent.Parent:WaitForChild("Values") and script.Parent.Parent:WaitForChild("Values"):WaitForChild("Owner") then
plr:WaitForChild("Board").Value = script.Parent.Parent.Name -- Board value is like Board1, Board2, etc in workspace.Boards
script.Parent.ProximityPrompt.Enabled = false
script.Parent.Parent:WaitForChild("Values"):WaitForChild("Owner").Value = plr.Name
script.Parent.Parent.Player.SurfaceGui.Text.Text = plr.DisplayName.."'s Board"
script.Parent.Parent.Time.SurfaceGui.Text.Text = "Best Time: "..plr.leaderstats.BestTime.Value
script.Parent.Parent.Played.SurfaceGui.Text.Text = "Played: "..tostring(plr.leaderstats.Plays.Value)
script.Parent.Parent.Raised.SurfaceGui.Text.Text = "Raised: "..tostring(plr.Values.Raised.Value)
script.Parent.Parent.Donated.SurfaceGui.Text.Text = "Donated: "..tostring(plr.Values.Donated.Value)
script.Parent.Parent.Screen.BrickColor = BrickColor.new("Cyan")
script.Parent.Parent.Timer.SurfaceGui.Text.Text = "Click the Start button to play!"
end
end
end)
DonationButton Script
local Market = game:GetService("MarketplaceService")
local HTTPService = game:GetService("HttpService")
local function CloneAssets(BoothName, Contents) -- BoothName is Board1, Board2, etc. from "plr.Board.Value"
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
for _, Asset in pairs(Contents) do
local data = Market:GetProductInfo(Asset, Enum.InfoType.Asset)
if data and data.IsForSale then
local Gui = script.Template:Clone()
Gui.Parent = game.Workspace.Boards[BoothName].DonationBoard.SurfaceGui.DonationFrame
Gui.Name = table.find(Contents, Asset)
Gui.PurchaseButton.Text = ""..data.PriceInRobux
Gui.Visible = true
Gui.ImportantValues:FindFirstChild("AssetId").Value = Asset
end
end
end
for _, Asset in ipairs(Contents) do
local data = Market:GetProductInfo(Asset, Enum.InfoType.Asset)
if data and data.IsForSale then
local MainGui = script.Template:Clone()
MainGui.Parent = game.Workspace.Boards[BoothName].DonationBoard.SurfaceGui.DonationFrame
MainGui.Name = table.find(Contents, Asset)
MainGui.PurchaseButton.Text = ""..data.PriceInRobux
MainGui.Visible = true
MainGui.ImportantValues:FindFirstChild("AssetId").Value = Asset
end
end
end
SuccessfulDonation(If donation is successful) script
local Market = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
Market.PromptProductPurchaseFinished:Connect(function(player, assetId, purchaseSuccess)
if purchaseSuccess then
-- Get the board this player owns
local boardName = player:WaitForChild("Board").Value
local board = game.Workspace.Boards:FindFirstChild(boardName)
if board then
-- Update raised/donated values
local productInfo = Market:GetProductInfo(assetId, Enum.InfoType.Asset)
local amount = productInfo.PriceInRobux
player.Values.Raised.Value += amount
board.Raised.SurfaceGui.Text.Text = "Raised: "..tostring(player.Values.Raised.Value)
end
end
end)
And again, I appreciate to any help!