Permission to add role?

help im trying to make a bot, it worked perfectly on my test server with test accounts but then i put it into production and now it's getting this error:

1|pixel school bot  | DiscordAPIError[50013]: Missing Permissions
1|pixel school bot  |     at SequentialHandler.runRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:933:15)
1|pixel school bot  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
1|pixel school bot  |     at async SequentialHandler.queueRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:712:14)
1|pixel school bot  |     at async REST.request (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:1321:22)
1|pixel school bot  |     at async GuildMemberRoleManager.add (/home/lb/pixel-school-bot/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:131:7)
1|pixel school bot  |     at async Client.<anonymous> (file:///home/lb/pixel-school-bot/commands/create-registration-channel.js:145:2) {
1|pixel school bot  |   rawError: { message: 'Missing Permissions', code: 50013 },
1|pixel school bot  |   code: 50013,
1|pixel school bot  |   status: 403,
1|pixel school bot  |   method: 'PUT',
1|pixel school bot  |   url: 'https://discord.com/api/v10/guilds/1089983841193709689/members/324534693024366603/roles/1090747389159157931',
1|pixel school bot  |   requestBody: { files: undefined, json: undefined }
1|pixel school bot  | }


The error is from line 145:
await guildMember.roles.add(studentRole);


I gave my bot admin permissions when creating the invite link, so what could the problem be? Shouldn't it be able to do literally everything?
image.png
Was this page helpful?