You're using MarketplaceService:PlayerOwnsAsset()
with a gamepass id, while that function only accepts the asset id.
Each gamepass has both asset id and gamepass id. Gamepass id is usually shorter than its asset id.
If you want to check if a player owns a gamepass by its gamepass id, you need to use MarketplaceService:UserOwnsGamePassAsync()
, like this:
1 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(player.UserId, 4653124 ) then |
But you can also obtain the asset id of your gamepass to be able to use it with PlayerOwnsAsset()
:
1 | if game:GetService( "MarketplaceService" ):PlayerOwnsAsset(player.UserId, 1929538711 ) then |
So, with some corrections, your code should look like this:
2 | game.Players.PlayerAdded:Connect( function (plr) |
3 | passOwners [ plr.Name ] = game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(plr.UserId, 4653124 ) |
4 | plr.CharacterAdded:Connect( function (char) |
5 | if passOwners [ plr.Name ] then |
6 | char:WaitForChild( "Humanoid" ).WalkSpeed = 36 |