UserOwnsGamepassAsync is not a valid member of MarketplaceService "MarketplaceService"

Greetings! I have today found this script on DevForum (although it’s almost 2 years old) that gives you the gear if you have bought the gamepass when you join the game.
However, I noticed this error (thread’s name) appear in the output. And since I’m quite unexperienced with scripting, I have not much idea how to fix that. Thanks :smile:

game.Players.PlayerAdded:Connect(function(player)
	local OwnsGamepass = MarketplaceService:UserOwnsGamepassAsync(player.UserId, GAMEPASS_ID)
	if OwnsGamepass then
		game.ReplicatedStorage.BoomBox:Clone()
		local clone = game.ServerStorage:WaitForChild("BoomBox"):Clone()
		clone.Parent = player.Backpack
	end
end)
1 Like

You made a typo on the API, it’s GamePass and not Gamepass.

2 Likes