UserOwnsGamePassAsync always returning false even though owned

Hi,

I’m having issues with UserOwnsGamePassAsync always returning false even though I have the gamepass. I tested this both in studio and in-game. What is the issue??

local ownsGamepass = MarketplaceService:UserOwnsGamePassAsync(Players.LocalPlayer.UserId, ToxicEmotes)
-- emote bindable hook
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
	if not ownsGamepass then
		TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("<font color='rgb(255,123,115)'>You need the 'Toxic Emotes' gamepass to use this!</font>")
		return
	end
	-- Only play emotes when idling
	if pose ~= "Standing" then
		return
	end
	if emoteNames[emote] ~= nil then
		-- Default emotes
		playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)

		return true, currentAnimTrack
	end

	-- Return false to indicate that the emote could not be played
	return false
end

I rechecked everything already, the gamepass id, the userid all match up.

1 Like

Try making a pcall inside your invoke function, something like this. Since you’re calling the “UserOwnsGamePassAsync” too early meaning it can fail. PCall helps it to return a safe true or false. (Also it can be costly if spammed so be cautious with it)

script:WaitForChild("PlayEmote").OnInvoke = function(emote)
   local success, ownsGamepass = pcall(function()
       return MarketplaceService:UserOwnsGamePassAsync(Players.LocalPlayer.UserId,ToxicEmotes)
   end)

   if ownsGamepass then
       -- Rest of your function.
   end
end
1 Like

You might also want to check you are using the AssetID for the gamepass. The one on the URL is not supported for UserOwnsGamePassAsync.

1 Like