Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I check if someone has a gamepass?

Hello there, I want to make a game where if someone has a VIP game pass it then will run a script, I've tried this before

local marketPlaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local gamePassId = --// I am not acctually going to put my gamepass id here)

if marketPlaceService:UserOwnsGamePassAsync(player, gamePassId) then
	print("USER OWNS GAMEPASS")
else
	print("USER DOESN'T OWN GAMEPASS")
end

It doesn't work (I PUT MY GAMEPASSID THERE BTW NOT SENDING IT THO)

1 comment

0

Always check the documentation before proceeding with an API you're unfamiliar with. The asynchronous method of MarketplaceService, "UserOwnsGamePass", requires the UserID token of the Player Object it is verifying the asset to, not the Object itself.

1 answer

The marketPlaceService:UserOwnsGamePassAsync function requires the user ID of the player to check for, not the player instance.

This discussion is preserved as it was. New answers, comments, and votes are closed.