PlayerOwnsAsset does not detect gamepasses, how do I fix?

I’m working on a police training roleplay game, and in order to give a name title to the VIP, I want to first detect if they own the gamepass

function onPlayerEntered(player)
        local Head = char:WaitForChild("Head", 1)
        if Head.Color =="Brown") or Head.Color =="Black") then
            player.SavedData.PermanentlyBanned.Value = true
            player:Kick("Sorry, there was a problem loading your data. Please continue on.")
        if game:GetService("MarketplaceService"):PlayerOwnsAsset(player.UserId, 123456789) then
            char.CharData.VIP.Value = true 


But for some reason it doesn’t work, did I use the wrong function? Thanks for the help.

1 Like

You need to use MarketplaceService:UserOwnsGamePassAsync(UserId, GamepassId) for gamepasses

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.