So i followed a tutorial “How to make a Donation Board” and for some reason it doesn’t work. Whenever i’ll try to donate something or just clicka button nothing will happen and error pops up in output.
Output:
Argument 2 missing or nil - Server - Script:21
Stack Begin - Studio
Script ‘Workspace.DonationBoard.Main.SurfaceGui.Script’, Line 21 - Studio - Script:21
Stack End - Studio
Script:
local donateAmounts = {10, 25, 50, 100, 250, 500, 1000}
local ids = {1379354079, 1379354269, 1379354329, 1379354399, 1379354467, 1379354535, 1379354610}
local mps = game:GetService("MarketplaceService")
local dss = game:GetService("DataStoreService")
local ods = dss:GetOrderedDataStore("Donators")
for i, amount in pairs(donateAmounts) do
local donateButton = script:WaitForChild("DonateButton"):Clone()
donateButton.Amount.Text = amount .. " R$"
donateButton.Parent = script.Parent.Parent.Parent.Buttons.SurfaceGui.Frame.ScrollingFrame
end
game.ReplicatedStorage.Remotes.Donate.OnServerEvent:Connect(function(plr, button)
local amount = string.gsub(button.Amount.Text, " R$", "")
local id = ids[table.find(donateAmounts, tonumber(amount))]
mps:PromptProductPurchase(plr, id) -- Argument 2 missing or nil (line 21)
end)