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.
Why don’t you try this? Let me know if it solved your issue
local MPS = game:GetService(“MarketplaceService”)
local PLD = 958300491
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, PLD)
end)
Things to check as its hard to diagnose your issue seeming as your coding seems to add up:
If the button doesn’t show up then please make sure the button is actually a button.
Assure that once the purchase is recognized the server handles the product. If it doesn’t the process will not work at all.
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.