Marketplace popup issues

Greetings! I just made a DeathGui for my story game, when the user dies a Gui comes up saying so, offering them to go back to the lobby or pay 15 robux to be resurrected into the game once again.

The lobby button works flawlessly, however the respawn button does not work at all, and the developer product doesn’t pop up asking the user to purchase it.

Script:

local button = script.Parent
local MPS = game:GetService("MarketplaceService")
local PLD = 958300491
local player = game:GetService("Players").LocalPlayer
Button.MouseButton1Click:connect(function()
MPS:PromptProductPurchase(player, PLD)
end)

Please try to help me fix this, thanks for the support,
George.

2 Likes

Why don’t you try this? Let me know if it solved your issue :slight_smile:

local MPS = game:GetService(“MarketplaceService”)
local PLD = 958300491
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, PLD)
end)

But that code does not work that is why I am asking for help to find out why it is not working. I have tried it it does not work.

1 Like

What do you mean? Please specify.

Sorry my bad, let me try it now.

1 Like

Do you mean that clicking it won’t prompt the player with the product?

Mhm, when I click it nothing happens.

1 Like

Have you tried making it so you get the prompt upon death?

Actually, is it a Script or a LocalScript?

LocalScript. It is a local script.

1 Like

Okay, have you tried making it so you automatically get the prompt when the player dies?

No, when you die the GUI comes up giving them the choice of going to the lobby or respawning by paying with robux.

1 Like

Well, I’m not sure what isn’t working.

What if you made it so when you die you get the prompt and if they don’t buy it within a certain amount of time, they’re teleported to the lobby?

do you mean the deathgui doesn’t show back up? or by what the title says is that it’s not prompting any purchases

1 Like

It is not promoting purchases.

1 Like

for the gui. have you disabled ResetGuiOnSpawn or smthing?

1 Like

Okay, this script I just made prompts the player if they are dead. Try that maybe?

repeat
wait(0.05)
until game.Players.LocalPlayer.Character:WaitForChild(“Humanoid”).Health == 0
wait(1)
local MPS = game:GetService(“MarketplaceService”)
MPS:PromptProductPurchase(game.Players.LocalPlayer, 958300491)

Things to check as its hard to diagnose your issue seeming as your coding seems to add up:

  1. If the button doesn’t show up then please make sure the button is actually a button.
  2. Assure that once the purchase is recognized the server handles the product. If it doesn’t the process will not work at all.
  3. Make sure your button is configured correctly so that it is selectable and enabled.

Your code can be shortened to this for ease seeming as we all know the purpose:

local plr = game.Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

-- script.Parent is a ImageButton or a TextButton
script.Parent.MouseButton1Click:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, 947365701) -- The number is the ID
end)

Please respond if none of these are the problem so I can help you get to the bottom of it.

1 Like

Should I put that in where the original local script linked to the Respawn button was?

1 Like