Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] MarketPlaceService not Detecting if I have gamepass or not?

Hi, so I just got introduced to a thing behind all those petty micro-transactions called MarketPlaceService.

After experimenting with it for a little, I managed to put together this script:

local market = game:GetService("MarketplaceService")
local players = game.Players
local ownsAsset = market.PlayerOwnsAsset
players.PlayerAdded:Connect(function (player)
	local success, doesPlayerOwnAsset = pcall(ownsAsset, market, player, 8642858)
	if doesPlayerOwnAsset then
		print(player.Name .. " owns the laser musket")
	else
		print(player.Name .. " doesn't own the laser musket")
	end
end)

However, I own the asset, and it just keeps saying that I don't own the laser musket.

There are no output (other than the message that says I don't own it) and really nothing else.

Help please!

1 answer

✓ Accepted answer

You are using the wrong function, for gamepasses you should use UserOwnsGamePassAsync, not PlayerOwnsAsset

Also, asset ids are different to gamepass ids, which is why the PlayerOwnsAsset doesn't work with gamepasses.

Give that a shot, maybe it'll help.

3 comments

0

Okay.

0

Thanks!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.