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

How do I check if someone has a gamepass?

Asked by 3 years ago
Edited by Ziffixture 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

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)

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. Ziffixture 6913 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

Ad

Answer this question