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

How to check if a player has a gamepass?

I'm looking for a way to check if a player has a gamepass, currently my way doesn't work for some reason.

game.Players.PlayerAdded:connect(function(plr)
wait(1)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr, 6058100) then
game.ReplicatedStorage.PlayerData:FindFirstChild(plr.Name)["VIP"].Value = 1
end

1 answer

✓ Accepted answer

It looks like you're submitting the entire Player object ("plr") as the first argument of UserOwnsGamePassAsync.

You only need to send the UserId.

Example:

MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)

1 comment

0

Irrelevant side comment: I noticed you're using "connect" in your original post. That still technically works, but "connect" has been deprecated in favor of the capitalized "Connect" (it's usually a preferred practice to capitalize the names of these functions)

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