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

Making a Gamepass GUI that gives the server Player Points when bought?

Asked by 10 years ago

I tried to make one by replacing the developer pass GUI, but it just broke the gui when i tried to purchase it.

the script was

local productId = 20804763 -- change to your developer product ID
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() --DONT CHANGE THIS
    Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

how do I make it work for a gamepass and still give the server player points?

1 answer

Log in to vote
0
Answered by
25564 200 Moderation Voter
10 years ago

I dug this out of my Database of scripts. According to this it was last accessed around 6 months ago so it should still work for you.

local buyButton = script.Parent
local productId = 19187437
local mps = game:GetService("MarketplaceService")

function getPlayerById(id)
    for i,v in pairs(game.Players:GetPlayers()) do
        if v.userId == id then
            return v
        end
    end
end

buyButton.MouseButton1Click:connect(function()
    mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

mps.ProcessReceipt = function(info)
    --Give effects or whatever
end

This is just placed inside the GUI Button. I am pretty sure that all purchases ingame provide playerpoints, however gear purchases may not but I am unsure sorry.

0
Thanks so much! ashpokeman5 2 — 10y
Ad

Answer this question