UserOwnsGamePassAsync() can only query local player?

I am trying to make VIP chat tags, and I have a module called titlemodule. Basically, I keep getting the error UserOwnsGamePassAsync() can only query local player, which I am confused about. Here is the code for the VIP module;

local HighRankList = {
	[311040474] = 'Head Dev',
}

local saves = {}

function CreateTable(plr, tagType)
	elseif tagType == 'Head Dev' then
			return {title = '[VIP] [OG] [Head Developer]', priority = 5, color = Color3.fromRGB(0, 0, 255),
		elseif tagType == "VIP" then
		return {title = '[OG] [VIP]', priority = 2, color = Color3.fromRGB(255, 255, 0), color0 = Color3.fromRGB(255,255,255)}
	elseif tagType == "OG" then
		return {title = '[OG]', priority = 1, color = Color3.fromRGB(40, 255, 147), color0 = Color3.fromRGB(255,255,255)}
	end
end
function sendInfo(player)
	local info = saves[player.UserId] 
	if not info then
		local priority = 0
		
		if HighRankList[player.userId] then
			info = CreateTable(player, HighRankList[player.UserId])
			elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 6770843) then
			info = CreateTable(player, "VIP")
		elseif game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 3200445423) then
			info = CreateTable(player, "OG")
		end
		
		if info == nil then
			info = "placeholder"
		end	
	
		saves[player.UserId] = info 
		return info
	else
		return info
	end
	
end

return sendInfo

This error keeps happening, and is super annoying. If anyone could help I would appreciate it.

1 Like

UserOwnsGamePassAsync(), when called from a LocalScript, can only check the local player. If you want to check for other players, you’ll have to call the function from the server. You can set up a remote event to check if other players own a gamepass.

5 Likes

Works like a charm. Thanks for the solution. I implemented what you suggested.

1 Like