How do I find a member's role in a group with node.js?

Hello!

Note: I am learning JavaScript so I may not be as competent with it as I would be with lua for example.

I am trying to find out how to find a specific user’s role in a Roblox Group via their UserId in node.js. Can anyone help me with how I would go about doing this? I have had a look and I can’t seem to find anything of any help. What I need is the ability to input a UserId, and the function to return a boolean value of:

  1. If the user is in the group
  2. If the user is of a specific role.

Any help is appreciated! Sorry for the awful layout of this post!

Cheers,
Ralph.

https://groups.roblox.com/docs

This should help! Just send a GET request to the endpoints. You can use axios or node-fetch.

1 Like
const https = require(`https`)

const userId = 39939779,
	groupId = 8535436

https.get(`https://groups.roblox.com/v2/users/${userId}/groups/roles`, resp => {
	let data = ``
	resp.on(`data`, chunk => data += chunk)
	resp.on(`end`, () => {
		const groups = JSON.parse(data).data
		let role
		for (const info of groups) {
			if (info.group.id == groupId) { 
				role = info.role
				break
			}
		}
		console.log(role)
	})
})

image

2 Likes

Cheers! It is working fine! Thanks for your help!