MarketplaceService:PromptPurchase() player should be of type Player, but is of type nil
Hello, I am trying to make it to where I can click on my GUI and click the textbutton and the game will prompt me to buy a GamePass. But I receive the error above. How do I go about this? The gui is in the Starter pack and it is in a script not a LocalScript.
local id = 0 function onClick() script.Parent.MouseButton1Click:connect(function(player) game:GetService("MarketplaceService"):PromptPurchase(player, id) end ) end script.Parent.MouseButton1Click:connect(onClick)
Mousebutton1Click
does not give a player parameter. I think you were confused with ClickDetectors.
This should be in a LocalScript because Gui is client-side.
Once in a LocalScript you can use game.Players.LocalPlayer