This is in a local script inside of a part.
local ID = 1369781260
plr = game.Players.LocalPlayer
debounce=false
function onTouched(hit)
if debounce==true then return end
debounce=true
game:GetService("MarketplaceService"):PromptPurchase(plr, ID)
debounce=false
end
script.Parent.Touched:connect(onTouched)

2 comments
Local scripts do not run in the workplace. Copy the part into the workspace but on the client side find the part and connect the event.
What?