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)
    player.CharacterAdded:Connect(function(char)
        local Head = char:WaitForChild("Head", 1)
        if Head.Color == BrickColor.new("Brown") or Head.Color == BrickColor.new("Black") then
            player.SavedData.PermanentlyBanned.Value = true
            player:Kick("Sorry, there was a problem loading your data. Please continue on.")
        end
        if game:GetService("MarketplaceService"):PlayerOwnsAsset(player.UserId, 123456789) then
            char.CharData.VIP.Value = true 
        end
    end)
end

game.Players.ChildAdded:Connect(onPlayerEntered)

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.