Here's my script. The gamepass I'm using is a random one that I own. Why doesn't this work?
Gamepass: https://www.roblox.com/game-pass/7233611/Shadow-Raid-Pack
local GamepassID = 7233611
game:GetService("Players").PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, GamepassID) then
print("This player has the gamepass!")
else
print("This player doesn't have the gamepass!")
end
end)

3 comments
Are you testing it in game or in the editor, because most of the time the editor doesnt have the ability to read that stuff.
I tried both and it doesn't work.
I found your problem "This method should not be used for game passes, since they use a separate ID system. Legacy game passes that still depend on an asset ID should use GamePassService:PlayerHasPass instead of this method."