this is basically what I have dumbed down. is there a better way to do this? it works for only my account and doesn't work for other accounts
`~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:Connect(function(plr)
1 | plr.CharacterAdded:connect( function (char) |
2 |
3 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(game.Players [ char.Name ] .UserId, id) then |
4 | print ("has gamepass) |
end end end
~~~~~~~~~~~~~~~~~ `
1 | local GamepassID = 0 --- id |
2 | game.Players.PlayerAdded:Connect( function (player) |
3 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(player.UserID, GamepassID) then |
4 | print ( "Player owns gamepass." ) |
5 | end |
6 | end ) |
Instead of game.Playersid, it should be (plr.UserId, "IDOFGAMEPASS"). This is the correct code:
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | plr.CharacterAdded:Connect( function (char) |
3 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(plr.UserId, "IDOFGAMEPASS" ) then |
4 | print ( "has gamepass" ) |
5 | end |
6 | end |
7 | end ) |
8 | end ) |
Hope this helps.