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

Why is my gamepass purchase function not working?

Asked by 5 years ago

So Im testing it with someone elses gamepass ID which I dont own and its not working??

Code:


script.Parent.MouseButton1Click:connect(function() -- This code can be within a 'LocalScript' object local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local gamePassID = 2205136 -- Change this to your game pass ID -- Function to prompt purchase of the game pass local function promptPurchase() local player = LocalPlayer local hasPass = false local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) end) if not success then warn("Error while checking if player has pass: " .. tostring(message)) return end if hasPass == true then -- Player already owns the game pass; tell them somehow else -- Player does NOT own the game pass; prompt them to purchase MarketplaceService:PromptGamePassPurchase(player, gamePassID) end end
0
Roblox only allows developers to sell assets owned themselves or by Roblox. You can't sell assets not owned by you nor by roblox, unless you allow Third-Party sales by checking the box that says 'AllowThirdPartySales' in the workspace Rare_tendo 3000 — 5y
0
Still doesn't work.. Weird Car00071 11 — 5y
0
is this a gui? MasonTheCreeperYT3 74 — 5y
0
Are you trying to run this as a local script? iplaymiecraftss 0 — 5y

Answer this question