Issue with purchases

Im trying to make a game where you can purchase any gamepass you want by just putting the id in it

whenever i try to purchase something with it says “Your purchase failed because something went wrong” but it works if i dont use a textbox. (this happens in studio and out of studio; this is not my problem or roblox's problem since i can still buy stuff in other games)

image

the script i use:

local MarketPlaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local textBox = script.Parent.ItemID
local purchaseButton = script.Parent.PurchaseButton

local function purchase()
	local gamepassId = tonumber(textBox.Text)
	print(gamepassId)
	MarketPlaceService:PromptProductPurchase(player, gamepassId)
end

purchaseButton.MouseButton1Click:Connect(purchase)

You must use PromptGamePassPurchase for prompting players to purchase gamepasses. PromptProductPurchase is for developer products

Make sure “Third-Party Purchases” is enabled in game settings

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.