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
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)