I have created a script that should prompt a gamepass to the player when clicked on through and image button but it doesn't seem to be doing that. Not sure what went wrong and I need some help.
local MarketplaceService = game:GetService("MarketplaceService") local MainFrame = script.Parent.MainFrame local janitorGamepass = MainFrame.JanitorGamepassFrame.JanitorGamepass local OpenShop = MainFrame.Parent.OpenShop local player = game.Players.LocalPlayer local janitorGamepassID = 8861359 janitorGamepass.MouseButton1Down:Connect(function() local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, janitorGamepassID) end) if hasPass then print("player alread has the gamepass") else MarketplaceService:PromptGamePassPurchase(player, janitorGamepassID) end end) OpenShop.MouseButton1Down:Connect(function() MainFrame.Visible = not MainFrame.Visible end)