Weird error when using UserOwnsGamepassAsync

So I have this code in a local script

local player1 = game.Players.LocalPlayer
local MPS = game:GetService("MarketplaceService")

if MPS:UserOwnsGamePassAsync(player1.UserId, 9898859) then
	for i,v in pairs(game.Workspace.GamepassOnlyDoor:GetChildren()) do
		v.CanCollide = false
	end
end

This worked fine but today my friend got this error

MarketPlace::UserOwnsGamePassAsync: failed due to empty response

How would I fix this? As far as I’m aware this has only happened this one time. This is in the roblox game and I was in his game and it worked fine for me. Have I missed anyting or forgot something?

EDIT: I have this is a local script so that the door only appears open for the player with a gamepass, and it is closed for everyone else

My guess is that this is simply the inherent occasional-error thrown by any “Async” function. This error should only happen very rarely since it doesn’t appear to be an actual issue with your code, rather simply an error on Roblox’s part. Make sure you wrap any Async in a pcall() so that errors do not break the script, and so that you can optionally do something to handle errors when they are thrown.

2 Likes