Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Game Pass doesn't work when i enter the game?

I added my code into the script when i enter the game to buy it it says product not available even the in the store it works fine heres the script

local productId = 7235846 -- Change to the ID of your developer product. local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)

here is the gamepass

https://web.roblox.com/game-pass/7235811/Skip-Stage

5 comments

0

SORRY WRONG CODE ON THE LINK ITS https://web.roblox.com/game-pass/7235846/Skip-Stage

0

This is not a request site. I say this because this is copied code plus you need to use the Lua button when writing a Lua question. 2 you need a script in server script service to communicate with Roblox using remote evens. 3 this script needs to be a local script in a gui button.

0

it is

0

..... this isnt a request site, just a helping site. are you out of your mind?

0

im asking for help

1 answer

I see what is wrong here. You need to prompt a purchase this way:

local MS = game:GetService("MarketplaceService")
local ID = 7235811
script.Parent.MouseButton1Click:Connect(function()
local Plr = script.Parent.Parent.Parent.Parent--Assuming you have a GUI button inside a GUI inside of playerGUI
if Plr then
MS:PromptGamePassPurchase(Plr, ID)
end
end)

This is assuming that you have the following hiarchy: StarterGui ScreenGui Button Script

This discussion is preserved as it was. New answers, comments, and votes are closed.