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

Wouldn't roblox gamepass tutorial always be false?

Asked by 6 years ago

I was testing the gamepass tutorial which is here: and I have realized that their script will always have haspass as false, is there a way to fix? I tested in studio and server within studio

Localscript:

01-- This code should be within a 'LocalScript' object
02local MarketplaceService = game:GetService("MarketplaceService")
03local Players = game:GetService("Players")
04 
05local gamePassID = 5143841 -- Change this to your game pass ID
06 
07-- Function to prompt purchase of the game pass
08local function promptPurchase()
09 
10    local player = Players.LocalPlayer
11    local hasPass = false
12 
13    local success, message = pcall(function()
14        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
15    end)
View all 31 lines...

Script::

01local MarketplaceService = game:GetService("MarketplaceService")
02 
03local gamePassID = 5143841 -- Change this to your game pass ID
04 
05-- Function to handle a completed prompt and purchase
06local function onPromptGamePassPurchaseFinished(player, purchasedPassID, purchaseSuccess)
07 
08    if purchaseSuccess == true and purchasedPassID == gamePassID then
09        print(player.Name .. " purchased the game pass with ID " .. gamePassID)
10        local Boombox = game.ServerStorage:FindFirstChild("BoomBox")
11Boombox:Clone().Parent = player.Backpack
12    end
13end
14 
15-- Connect 'PromptGamePassPurchaseFinished' events to the 'onPromptGamePassPurchaseFinished()' function
16MarketplaceService.PromptGamePassPurchaseFinished:Connect(onPromptGamePassPurchaseFinished)

Output: false, SilviaTheros911 purchased the game pass with ID 5143841, false SilviaTheros911 purchased the game pass with ID 5143841, false

1
when testing it in studio you don't actually get the gamepass User#22604 1 — 6y
0
Ty worked SilviaTheros911 0 — 6y

Answer this question