so im making a weird game, where you can buy golden dirt which is a 1 time purchase. Not gonna lie, im completely new to prompt purchases so i dont know much, but i think this should work, but suprisingly it doesnt. Heres the script:

local MarketplaceService = game:GetService("MarketplaceService")
function spawndatdirt()
			local dirt = Instance.new("Part")
			dirt.Parent = game.Workspace.Model
			dirt.Size = Vector3.new(15.74, 2.375, 8.9)
			dirt.Position = game.Workspace.GOLDENDIRT
			dirt.Material = "Grass"
			dirt.BrickColor = BrickColor.new("New Yeller")
		end
MarketplaceService.PromptPurchaseFinished:connect(function (id)
	-- Print all the details of the prompt, for example:
	-- PromptPurchaseFinished PlayerName 11377306 true
	if id == 951283289 then
		spawndatdirt()
	end
end)

would appreciate if someone knows how to fix it

1 comment

0

Btw you can also check if the purchase was made or not, someone can cancel the prompt and the event will still fire, 3rd parameter is purchased or not (bool)