- A working devproduct system.
- Issue is that it says the receipt missing one of its intents but it doesn’t
- I’ve tried roblox default script for it and it doesn’t work
Server Side
game.ReplicatedStorage.ShopRelated.P.OnServerEvent:Connect(function(plr, v)
local productFunctions = {}
print(v)
productFunctions[v] = function(receipt, player)
game.ReplicatedStorage.ShopRelated.P:FireClient()
return true
end
local function processReceipt(receiptInfo)
local userId = receiptInfo.PlayerId
local productId = receiptInfo.ProductId
local player = Players:GetPlayerByUserId(userId)
if player then
local handler = productFunctions[productId]
local success, result = pcall(handler, receiptInfo, player)
if success then
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Failed to process receipt:", receiptInfo, result)
end
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
MarketplaceService.ProcessReceipt = processReceipt
end)
Client Side
Products.Parent.PurchaseInfo.Buy.MouseButton1Click:Connect(function()
if #Products.Parent.PurchaseInfo.Info.Text >= 10 or #Products.Parent.PurchaseInfo.name.Text >= 7 then
MarketPlace:PromptProductPurchase(plr,Config.Products[number])
game.ReplicatedStorage.ShopRelated.P:FireServer(Config.Products[number])
game.ReplicatedStorage.ShopRelated.P.OnClientEvent:Connect(function()
game.ReplicatedStorage.ShopRelated.S:FireServer(Products.Parent.PurchaseInfo.name.Text, Products.Parent.PurchaseInfo.Info.Text, "order")
end)
else
Products.Parent.PurchaseInfo.Info.Text = ""
Products.Parent.PurchaseInfo.Info.PlaceholderText = "Please fill the information!"
Products.Parent.PurchaseInfo.name.Text = ""
Products.Parent.PurchaseInfo.name.PlaceholderText = "Please write your name!"
end
FYI: The phrase Config.Products[number] is another formula that finds the correct array contains devproduct id for each button