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

GamePass script isn't working?

Asked by 6 years ago
Edited 6 years ago

I added a gamepass to my game i watched multi videos and i looked at the wiki and i can't find out why it says i don't own the gamepass. (BTW I KNOW FOR SURE I OWN IT)

game.Players.PlayerAdded:Connect(function(plr)
    if game:GetService("GamePassService"):PlayerHasPass(plr, 4936471) then
        print("yes")
    else
        print("no")
    end
end)

1 answer

Log in to vote
0
Answered by 6 years ago

You used UserHasGamepass which is Deprecated, you should be using UserOwnsGamePassAsync, also use MarketplaceService instead of GamepassService.

GamepassID = 4936471

game.Players.PlayerAdded:Connect(function(plr)

    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, GamepassID) then
        print("yes")
    else
        print("no")
    end

end)
Ad

Answer this question