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

(UNSOLVED) Help With Making My Gamepass Purchase Script Work Without Having To Rejoin Game?

Asked by 2 years ago
Edited 2 years ago

I Am Making A Gamepass Script and I Am Trying To Make It So The Players Get The Gamepass Item Without Rejoining The Game Here Is The Script: This Is All In A Server Script btw

01local event = game.ReplicatedStorage.RemoteEvents.GamePPP
02local gamepassid = 50179266
03local last = game.ReplicatedStorage.RemoteEvents.Last
04local part = game.Workspace.VIPRoomPurchase
05local mps = game:GetService('MarketplaceService')
06 
07 
08 
09 
10local function workpls(player, gamepassid, wasPurchased)
11    local plr = game.Players:GetPlayerFromCharacter(player.Parent)
12    if plr then
13        if mps:UserOwnsGamePassAsync(plr.UserId, 50179266) then
14            print('User Already Owns Gamepass!')
15        else
View all 25 lines...

1 answer

Log in to vote
1
Answered by
VAnkata20 135
2 years ago
Edited 2 years ago

I have tried this in studio and it seems to work

1local MarketplaceService = game:GetService("MarketplaceService")
2 
3local gamePassId = 000000 --Your GamepassID
4 
5MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasePassID, purchaseSuccess)
6    if purchaseSuccess == true and purchasePassID == gamePassId then
7        print(player.Name.." Bought the Gamepass")
8    end
9end)

keep in mind that that this script should be in SSS (ServerScriptService) to work

Ad

Answer this question