Nft Game 3rd video enable error

Hey. I’ve been following along the tutorial on how to create a NFT game, I’ve got a issue on the 3rd part of the tutorial, on the enable feature, saying “Uncaught (in promise) TypeError: Cannot read property ‘enable’ of undefined
at renderGame (main.js:22)
at init (main.js:14)
at main.js:41”

This is the part of the code, where it says the issue is occuring
async function init() {
try {
let user = Moralis.User.current();
$("#login_button").click(async() =>{
user = await Moralis.Web3.authenticate();
} catch (error) {
async function renderGame(){
let petId = 0;
window.web3 = await Moralis.web3.enable();
let abi = await getAbi();
let contract = new web3.eth.Contract(abi, CONTRACT_ADDRESS);
let data = await contract.methods.getTokenDetails(petId).call({from: ethereum.selectAddress});



function getAbi(){
return new Promise((res)=>{
$.getJSON(“Token.json”, ((json)=>{




Thanks, hope someone can help me out

Please read the post about how to add code to the forum.
It should be window.web3 = await Moralis.Web3.enable(); instead of window.web3 = await Moralis.web3.enable();

Thanks mate. I’ve changed what you said, but still, same error

Please format your code properly in the original forum post (you can use Preformatted Text button), probably you have multiple errors there.