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

UserOwnsGamePassAsync says I don't own game pass?

Asked by
danglt 185
4 years ago

When I try to use this script it says I don't own the game pass, witch i do so I don't know what the problem is

if game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer,1669132) then print("Player has gamepass")
else print("player dont got it :(")
 end

1 answer

Log in to vote
2
Answered by
tzmods 59
4 years ago

Reasons it was not working

You were not getting the users ID, instead, you were getting there name. This is how you should use :UserOwnsGamePassAsync()

:UserOwnsGamePassAsync(UserID,GamePassID)

Also, I recommend using :GetService() when fetching market place.

game:GetService("MarketplaceService")

The fix

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players.LocalPlayer.userId,1669132) then
    print("Player has gamepass")
else
    print("player dont got it :(")
end
Ad

Answer this question