✓ Accepted answer
You made a mistake at events ;]
local assetId = 27112438
function die() script.Parent.MouseClick:connect(function(player)
Game:GetService("MarketplaceService"):PromptPurchase(player, assetId) end) end
script.Parent.MouseButton1Down:connect(die)
The problem you have is that you made a little confusion with events.
You had already set the event, but then, you send the exact same event again. (This makes LUA confusion and breaks script)
Try removing the function die() and the last even listener, like MasterDaniel told you.
script.Parent.MouseClick:connect(function(player) Game:GetService("MarketplaceService"):PromptPurchase(player, assetId) end)
Hope this helps you!
Thanks,
marcoantoniosantos3
1 comment
Why put the function that sells the item inside a pointless function. Try replacing script.Parent.MouseClick:connect(function(player) with script.Parent.MouseButton1Down:connect(function(player) and delete the function die() and the event listener at the end