I want to make a nuke that spawns in the workspace when you buy a developer product.
I tested if my script works using prints before trying to spawn the nuke, but the prints aren’t running.
Here is my code within a localscript in a textbutton.
local MPS = game:GetService("MarketplaceService")
local player = script.Parent.Parent.Parent.Parent
local nukeEvent = game.ReplicatedStorage.NukeEvent
local nukeProductId = 2707983803
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, nukeProductId)
end)
MPS.PromptPurchaseFinished:Connect(function(player, ProductId, isPurchased)
if isPurchased and ProductId == nukeProductId then
print("Player has bought nuke")
end
end)
Nevermind, figured out the problem. I needed to use MPS.PromptProductPurchaseFinished instead of PromptPurchaseFinished.