Problem with donation

Guys. Writes: Something went wrong. What should I do, please help me. Donat is fully configured and in the game.

local gamePassId = 151394449
local buyButton = script.Parent

local function onBuyButtonClick()
local player = game.Players.LocalPlayer

if player then
	local success, error = pcall(function()
		game:GetService("MarketplaceService"):PromptProductPurchase(player, gamePassId)
	end)

	if not success then
		warn("Failed to initiate purchase: " .. tostring(error))
	end
else
	warn("Player is not authenticated.")
end

end

buyButton.MouseButton1Click:Connect(onBuyButtonClick)

2 Likes

Might have HTTP requests and/or API access disabled in the game.

2 Likes

2 Likes

No, it’s on. and third party purchases included

1 Like

Are there any errors in the output?

1 Like

No. Could the problem be that the game was made in a group?

1 Like

The problem is not with the group.

1 Like

I tested on different accounts but the problem is still the same.

1 Like

Wrong gamepass id maybe?

Try putting in the id one: 626083379

1 Like

Nope,


Could the problem be in Prompt Purchase, PromptProduct Purchase. If you choose the second option, it says: Something went wrong.

1 Like

Check if the gamepass is on the sale.

1 Like

Dude, of course. I can’t find the logic of this error

1 Like

Idk what doesn’t work here. Everything is ok here!

Found the problem, you used incorrect PromptPurchase…

local gamePassId = 151394449
local buyButton = script.Parent

local function onBuyButtonClick()
	local player = game.Players.LocalPlayer

	if player then
		local success, error = pcall(function()
			game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassId)
		end)

		if not success then
			warn("Failed to initiate purchase: " .. tostring(error))
		end
	else
		warn("Player is not authenticated.")
	end
end

buyButton.MouseButton1Click:Connect(onBuyButtonClick)

image

1 Like

Yay! I’ve been scratching my head for a long time, thank you very much!

1 Like

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