Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

MarketplaceService throwing an error?

Asked by 8 years ago

I've ran into an issue with my developer product GUI. The developer console shows this: 15:42:32 -- MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type nil

However, I went to the script and looked at line 8:

game:GetService("MarketplaceService"):PromptProductPurchase(Player, devProductId)

Is there a reason the dev console is showing this error?

2 answers

Log in to vote
0
Answered by
Hexcede 52
8 years ago

The player is nil. You must be getting the Player wrong or you put too many .Parents or something.

Ad
Log in to vote
0
Answered by 8 years ago

As crazycittykat says, your Player variable is nil. This can happen if:

  • You never assign to it (ex perhaps you assigned to a variable with a different spelling or case -- ex, "player" instead of "Player")
  • You say Player = game.Players:FindFirstChild("bob") when there are no players with that username

Answer this question