:PlayerHasPass always returns false?

I am trying to add a new gamepass. However for some reason the code I use to check whether the player has the gamepass always returns false. I honestly dont know what causes it. I uploaded the gamepass hours ago, so roblox must’ve registered that i have the gamepass.

https://www.roblox.com/game-pass/5119145/Disinfection-Grenade

game.Players.PlayerAdded:connect(function(p)
  wait(0.5)
  if game:GetService("GamePassService"):PlayerHasPass(p,5119145) then
    print("Yes")
    game.ServerStorage.DisinfectionGrenadee:Clone().Parent = p.Backpack
    game.ServerStorage.DisinfectionGrenadee:Clone().Parent = p.StarterGear
  else
    print("no")
    end
end)

Use MarketplaceService:UserOwnsGamePassAsync now.

3 Likes

From the Developer Hub, recommended call:

	-- Check if the player already owns the game pass
	local success, message = pcall(function()
		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
	end)

https://www.robloxdev.com/api-reference/function/MarketplaceService/UserOwnsGamePassAsync
(https://www.robloxdev.com/articles/Game-Passes-One-Time-Purchases)

4 Likes

i thought it had something to do with that. i just couldnt find that function on the wiki

EDIT: im dumb, i read over it

1 Like