1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | if game.MarketplaceService:PlayerOwnsAsset(plr, 5397071 ) then |
3 | print ( "Success, player has asset." ) |
4 | else |
5 | print ( "Player doesn't own this asset." ) |
6 | end |
7 | 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)
PlayerOwnsAsset()
not work, you need to use UserOwnsGamePassAsync()
Wiki: Roblox Wiki Page - UserOwnsGamePassAsync()
You can use this script:
01 | local id = 5397071 -- Id of your gamepass |
02 |
03 | game:GetService( "Players" ).PlayerAdded:Connect( function (plr) |
04 | print (plr.Name .. " joined" ) |
05 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(plr.UserId,id) then |
06 | print ( "Success, player has asset." ) |
07 | else |
08 | print ( "Player doesn't own this asset." ) |
09 | end |
10 | 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.