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

How to check if a player has a gamepass?

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago

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)
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) vanilla_wizard 336 — 5y
Ad

Answer this question