Scripting not working to detect NFT, or is my code wrong?

I have been testing out making my parcel exclusive to holders of my collections, I used the base asset from the library. It doesn’t seem to check people as they enter. I added this script and used a current ETH NFT contract to test since mine isn’t released yet;

// Upon entry into the parcel, this script will call opensea to check if a user has an NFT or not;
// It will then set the parcel privacy once it knows if the user has the NFT or not. Any help or guidance would be amazing, thanks!

my_contract = “0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85”

parcel.on(‘playerenter’,e=>{
parcel.isPrivate = false // set to false to check if player has eth NFT first
function evaluateUsers(hasNFT){
if(hasNFT){
parcel.allow(e.player.wallet)
}
console.log(hasNFT)

parcel.isPrivate = true // then set to true; this will cause all users not allowed to be kicked

}

e.player.hasEthereumNFT(my_contract,evaluateUsers)
})

1 Like