I'm trying to add a role to a member when they join my server, here is the code I have:
The problem I'm getting is "ReferenceError: roles is not defined"
can someone please help me solve this?
client.on("guildMemberAdd", (member) => {
console.log("User " + member.user.username + " has joined the server!");
var role = member.guild.roles.cache.find((role) => role.name === "Javjajjaj");
roles.add(role);
});
The problem is that the
roles
variable is never defined within your piece of code.