I want a block to spawn whenever someone buys a dev product. However, the block is not spawning when I buy the dev product. I have tried to add prints into the function, but they are not running either. Here is my code in a ProximityPrompt in a part in the workspace.
local MPS = game:GetService("MarketplaceService")
local productID = 2679561268
local ProxPrompt = script.Parent
ProxPrompt.Triggered:Connect(function(plr)
MPS:PromptProductPurchase(plr, productID)
end)
MPS.PromptPurchaseFinished:Connect(function(player, purchasedProductID, isPurchased)
if purchasedProductID == productID and isPurchased then
print(player.Name .. " has purchased a block!")
local newBlock = Instance.new("Part")
newBlock.Size = Vector3.new(4, 4, 4)
newBlock.Parent = workspace
newBlock.CFrame = CFrame.new(80, 80, 0)
newBlock.Color = Color3.new(
math.random(),
math.random(),
math.random()
)
else
print(player.Name .. " canceled the purchase.")
end
end)