title: Discord.js TypeError: Cannot read properties of undefined (reading 'add')
body: <p>What is wrong with what I'm doing? I'm trying to make some code that detects when someone is trying to scam people. That's not the part that I'm have an error with. The error comes when I try to give the author of the message my muted role. Someone please help!</p>
  <p>Here's the code:</p>
  <pre class="lang-js prettyprint-override"><code>// mute for 3 hours if anyone is scamming
  client.on(&quot;messageCreate&quot;, async message =&gt; {
    if (message.author.bot) return;
    if (message.content.includes(&quot;free robux&quot; || &quot;free v-bucks&quot; || ...)) {
      const target = message.author.username;
      const mutedRole = message.guild.roles.cache.get(&quot;1004037957902147676&quot;);
  
      message.delete();
      message.channel.send(&quot;@&quot; + message.author.username + &quot;, scamming is...&quot;);
      message.member.roles.add(&quot;1004037957902147676&quot;);
  
      setTimeout(() =&gt; {
        target.roles.cache.remove(mutedRole);
      }, 5000);
    }
  }, {});
  </code></pre>
  <p>Here's the error:
  Cannot read properties of undefined (reading 'add')</p>
  <p>Thanks!</p>