"Unable to cast value to Object"?

I’m making a GUI for my game so you can buy certain passes or products, using a simple script.

local mps = game:GetService("MarketplaceService")
local lp = game.Players.LocalPlayer
local btn = script.Parent


It just errors “Unable to cast value to object”

MarketplaceService:PromptGamePassPurchase takes a player instance, not their user ID. You may have gotten this confused with MarketplaceService:UserOwnsGamePassAsync which does take in a user ID.

1 Like