So for my game I have a nuke developer product that allows you to purchase a developer product for a nuke to spawn in the map and kill all the players.
But when I click the button it doesn't let me purchase it so it happens..
local mps = game:GetService("MarketplaceService")
local gamepass_id = 1087678048
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end)
mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.StarterGui.ScreenGui.TextButton.Visible = false
game.Workspace.countdown.Disabled = false
game.workspace.nuketime.Playing = true
game.workspace.nuketime.Looped = true
wait(16)
local nukerO = game.ReplicatedStorage.Nuke:Clone()
nukerO.Parent=game.Workspace
game.Workspace.nuketime.Playing = false
game.Workspace.nuketime.Looped = false
wait(30)
game.Workspace.countdown.Disabled = true
game.StarterGui.ScreenGui.TextButton.Visible = true
end
end)
could I have some help?

2 comments
wouldnt you use promptproductpurchase instead of gamepass purchase because you're making a product not gamepass
When trying to purchase it I get this error "Your purchase failed because something went wrong. Your account has not been charged. Please try again later." and be aware I am on the actual roblox game itself not studio.