Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am making a nuke developer product but the prompt wont let the player buy it?

Asked by 4 years ago

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?

1
wouldnt you use promptproductpurchase instead of gamepass purchase because you're making a product not gamepass sean_thecoolman 189 — 4y
0
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. ment34591 20 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

It is actually so simple all I did was overthink.

on line 6 all I had to do was replace PromptGamepassPurchase with PromptProductPurchase, and I was all set!

local mps = game:GetService("MarketplaceService")
local gamepass_id = 1087678048

script.Parent.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    mps:PromptProductPurchase(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)
Ad

Answer this question