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)
