Why is this error occuring?

This error occurs immediately whenever I start my game.

Code:

Error:

Thanks to any who can help. The script is located inside of ServerScriptService. If you need anymore info, just ask.

Thank in advance!

1 Like

Remove the () at the end of the last line, you’re firing the function isntead of setting it as the callback.

Line 22 should be

Market.ProcessReceipt = processReceipt
2 Likes
local marketPlace = game:GetService("MarketplaceService")
local productID = 2307902157


marketPlace.ProcessReceipt = function(receiptInfo)
    
    local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)

    if receiptInfo.ProductId == productID then
        player.leaderstats.Gold.Value += 100
        print(player.Name .. " just purchased a devproduct")
    end

    return Enum.ProductPurchaseDecision.PurchaseGranted
end

Yup what @EmbatTheHybrid said is 100% correct, and should be the answer, I am pretty sure…

2 Likes

Okay @EmbatTheHybrid, I’ll check it out. The DevProduct itself is acting up now, but i will definitely try what you said.

1 Like

Well, now this is showing up.

Hooray. Does anyone know what this is?


local Market = game:GetService('MarketplaceService')
local productId = 2307902157

local function promptPurchase()
	
	local player = game.Players.LocalPlayer
	-- ask player if they want to buy devproduct
	Market:PromptProductPurchase(player, productId)
end
script.Parent.MouseButton1Click:Connect(promptPurchase)

This is the local code.

What’s the item you’re trying to prompt?

100 Gold, at the top of the screenshot.

Did you remember to enable Third-Party sales? And are you using the right id? Check both of those out

2 Likes

is that id correct???

The id was incorrect - thanks so much!

Beginner mistakes :expressionless: :rofl: :worried: :flushed: :confounded:.

2 Likes