MarketplaceService doesn't recognize when I do and do not own a gamepass

Howdy y’all.

I recently wrote down this script, it’s meant to check if I do or do not own a gamepass.

game.Players.PlayerAdded:Connect(function(plyr)
	local marketplaceservice = game:GetService("MarketplaceService")
	local UserOwnsGamePassAsync = marketplaceservice.UserOwnsGamePassAsync
	
	local success, doesPlayerOwnAsset = pcall(UserOwnsGamePassAsync, marketplaceservice, plyr, 14924046)
	if doesPlayerOwnAsset then
		print("si")
	else
		print(plyr.Name.." doesn't have VIP, what a loser!")
	end
end)

I wrote the script in how you would with how MarketplaceService | Documentation - Roblox Creator Hub would be written. Can somebody help me out? The only output I get is “si” when changing to gamepasses I don’t own.

Thank you.

There is no need for the pcall function.

Just write it like normal

local User_Owns_Gamepass = marketplaceservice:UserOwnsGamePassAsync(plr.userid, gamepass_id)

if User_Owns_Gamepass then
warn("Owns")
elseif not User_Owns_Gamepass  then
warn("Does not own")
end

Thank you, I overthought this.

1 Like