Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's wrong with my script to give player credits/points for purchasing a dev-product?

Asked by 9 years ago

purchased = false local Id = 20628541 script.Parent.ClickDetector.MouseClick:connect(function(player) Game:GetService("MarketplaceService"):PromptPurchase(player, Id) purchased = true if purchased == true then player.leaderstats.Points = player.leaderstats.Points + 10 end end)

0
Bump1 Infrare 0 — 9y
0
This however, is against the new ROBLOX rules of selling player points or "Player Points shops", at least, this is how I would classify it. M39a9am3R 3210 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Well, when you do that, you ask them to buy it, but right after you ask them, you don't even wait to see if they buy it or not, you just give points away, for free! However, there is an event that will tell you whether or not someone purchased your item. The link is here.

And this is how you'd use it:

local Id = 20628541 
script.Parent.ClickDetector.MouseClick:connect(function(player)
    Game:GetService("MarketplaceService"):PromptPurchase(player, Id)
    Game:GetService("MarketplaceService"):PromptPurchaseFinished:connect(function(player, Id, purchased)
        if purchased then
            player.leaderstats.Points = player.leaderstats.Points + 10
        end
    end)
end)
Ad

Answer this question