Hello! I've made a gui to purchase a gamepass. The button is scripted with the following code:
local plr = game.Players.LocalPlayer local button = script.Parent local MarketplaceService = game:GetService("MarketplaceService") script.Parent.MouseButton1Click:Connect(function() MarketplaceService:PromptGamePassPurchase(plr, 3312863) end)
It fails, and the output text is: MarketplaceService:PromptGamePassPurchase() player should be of type Player, but is of type nil Any help?
You can only use LocalPlayer
in a local script. So replace this with a local script and it should work like a charm! (btw change mousebtutton1click to mousebutton1down it just makes it feel more clicky)