Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is wrong with my Developer Product?

When I was testing my own developer product for a game I am making, it prompts the purchase.. However when I press the buy button, it says that Roblox is under maintanence.. Any reason why that would come up? Maybe an anti scam because something is wrong with my script?

Script 1- Located in the button you press to prompt the purchase

wait(1)
local player = game.Players.LocalPlayer
local button = script.Parent
local productId = button.ID.Value
--
button.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

Script 2- Located in Server Script Service -Makes sure that they bought it and gives them the cash

local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

CASHID = 19575333 
CashAmount = script.Cash --This is the IntValue located inside of this script (The Child)

MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKey, 1)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == CASHID then


lds = v.PlayerGui.Currency.CurrencyFrame.Money.Amount --This is there Currency GUI
if lds ~= nil then
cs = lds.Value
if cs ~= nil then
cs.Value = cs.Value + CashAmount.Value
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted	
end

1 answer

For script 1, You put a ")" Next to the end. That ")" is for Global Functions.

2 comments

0

When I removed that end, It gave me a syntax error at line 6

0

put" --" Next to it (line 6)

This discussion is preserved as it was. New answers, comments, and votes are closed.