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

What's wrong with this has asset check? It doesn't detect if player has asset.

game.Players.PlayerAdded:Connect(function(plr)
	if game.MarketplaceService:PlayerOwnsAsset(plr, 5397071) then
		print("Success, player has asset.")
	else
		print("Player doesn't own this asset.")
	end
end)

Problem is it prints "Player doesn't own this asset" even when a player does have an asset. I made sure ID is correct. (Do not check what is there :P)

3 comments

0

That's because it's a gamepass id, not asset id. You need to either use GamePassService:PlayerHasPass() or MarketplaceService:UserOwnsGamePassAsync()

0

GamePassService method is broken and outdated now.

0

looking at the page of the asset associated with the id, it's not a gamepass

2 answers

✓ Accepted answer

PlayerOwnsAsset() not work, you need to use UserOwnsGamePassAsync()

Wiki: Roblox Wiki Page - UserOwnsGamePassAsync()

You can use this script:


local id = 5397071 -- Id of your gamepass

game:GetService("Players").PlayerAdded:Connect(function(plr)
	print(plr.Name .. " joined")
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id) then
	print("Success, player has asset.")
	else
	print("Player doesn't own this asset.")
	end
end)

Hope it helped!

Weird thing, if I type: roblox.com/game-pass/5397071 is not equal to roblox.com/catalog/5397071, it's different things! In 1 there is some awful shirt, in 1 my gamepass. Weird. Anyways, I must check it.

1 comment

0

CATALOG = Item, GAME-PASS = gamepasses

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