PromptGamePassPurchase not working

I have made this coding awhile ago and it was working but when I tried it today, it doesn’t work. The game pass is part of the place (so it’s not a 3rd party purchase)

local plr = game.Players.LocalPlayer

local id = 9291228

script.Parent.MouseButton1Click:Connect(function()

local mps = game:GetService("MarketplaceService")

mps:PromptGamePassPurchase(plr, id)

end)

2 Likes

Does it click the button?
It happened to me once, I realized a frame was blocking the way so it couldn’t be clicked.
Can you print ‘Clicked’ each time when the event is firing?
And tell me if it prints ‘Clicked’.

Have you enabled studio api services?

If not do this:
home → settings → security → Enable Studio API Services

Wait. The problem was the Roblox cleared the LocalScript so the script would only print("Hello World").

It doesn’t work again and its outputting:

[09:12:35.242 - CorePackages.Packages._Index.roblox_rodux.rodux.NoYield:26: CorePackages.Packages._Index.roblox_purchase-prompt.purchase-prompt.Localization.LocalizationService:194: invalid use of '%' in replacement string](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.244 - CorePackages.Packages._Index.roblox_purchase-prompt.purchase-prompt.Localization.LocalizationService:194 function getString](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.245 - CorePackages.Packages._Index.roblox_purchase-prompt.purchase-prompt.Components.Connection.TextLocalizer:20](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.246 - CorePackages.Packages._Index.roblox_purchase-prompt.purchase-prompt.Components.Connection.LocalizationContextConsumer:20 function render](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.247 - CorePackages.Packages._Index.roblox_roact.roact.Component:330 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.248 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.250 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.252 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.253 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:308 function mountFunctionVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.253 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:361 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.254 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.254 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.255 - CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:215 function mountHostNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.255 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:359 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.256 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.256 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.257 - CorePackages.Packages._Index.roblox_roact.roact.Component:333 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.257 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.258 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.258 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.258 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:308 function mountFunctionVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.259 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:361 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.260 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.260 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.261 - CorePackages.Packages._Index.roblox_roact.roact.Component:333 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.261 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.262 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.262 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.262 - CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:215 function mountHostNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.263 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:359 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.263 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.264 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.264 - CorePackages.Packages._Index.roblox_roact.roact.Component:333 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.265 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.265 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.265 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.266 - CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:215 function mountHostNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.266 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:359 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.267 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.268 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.269 - CorePackages.Packages._Index.roblox_roact.roact.Component:333 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.269 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.270 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.270 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.270 - CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:215 function mountHostNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.271 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:359 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.271 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.272 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.273 - CorePackages.Packages._Index.roblox_roact.roact.Component:333 function __mount](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.274 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.274 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.274 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.275 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:308 function mountFunctionVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.275 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:361 function mountVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.276 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.276 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.277 - CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:273 function updateHostNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.277 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:234 function updateVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.278 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:72 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.278 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.279 - CorePackages.Packages._Index.roblox_roact.roact.Component:496 function __resolveUpdate](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.279 - CorePackages.Packages._Index.roblox_roact.roact.Component:434 function __update](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.279 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:238 function updateVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.280 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:72 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.280 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.281 - CorePackages.Packages._Index.roblox_roact.roact.Component:496 function __resolveUpdate](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.281 - CorePackages.Packages._Index.roblox_roact.roact.Component:434 function __update](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.282 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:238 function updateVirtualNode](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.282 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:72 function updateChildren](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.283 - CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.283 - CorePackages.Packages._Index.roblox_roact.roact.Component:496 function __resolveUpdate](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.284 - CorePackages.Packages._Index.roblox_roact.roact.Component:434 function __update](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.284 - CorePackages.Packages._Index.roblox_roact.roact.Component:161 function setState](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.284 - CorePackages.Packages._Index.roblox_roact-rodux.roact-rodux.connect:92](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.285 - CorePackages.Packages._Index.roblox_rodux.rodux.Signal:70 function fire](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.285 - CorePackages.Packages._Index.roblox_rodux.rodux.Store:125](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

  [09:12:35.286 - ](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

09:12:35.286 - Stack Begin

[09:12:35.286 - Script 'CorePackages.Packages._Index.roblox_rodux.rodux.NoYield', Line 13 - function resultHandler](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#13)

[09:12:35.287 - Script 'CorePackages.Packages._Index.roblox_rodux.rodux.NoYield', Line 26 - function NoYield](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7B02278142-db5d-46ee-9fac-93a68ef66d89%7D&gst=2#26)

[09:12:35.287 - Script 'CorePackages.Packages._Index.roblox_rodux.rodux.Store', Line 124 - function flush](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7Bc69a3eba-e2fa-471d-aea2-17022b2c8c66%7D&gst=2#124)

[09:12:35.287 - Script 'CorePackages.Packages._Index.roblox_rodux.rodux.Store', Line 46](rbxopenscript://www.dummy.com/dummy?scriptGuid=%7Bc69a3eba-e2fa-471d-aea2-17022b2c8c66%7D&gst=2#46)

09:12:35.288 - Stack End

I think that’s just part of the Roblox CoreScripts itself, so you don’t have to worry.

1 Like

It doesn’t work at all though.