I'm trying to make a table of everyone in a certain group rank then it would select a random one then they would get a special tag. I know how to the tag part but I don't know about putting everyone in the table. As I have loads of people I want to put in the table it would take a long time to do on my own, so I need a script to do it.
Any help is appreciated.
If you can do with noblox.js, what would the code be?
The only way of doing this is by using Node.js. I'd recommend using Glitch.com to host it. I have created you a script in JavaScript which will allow you to get the members.
const request = require('request'); const express = require('express'); var app = express(); app.use(express.static('public')); function getPlayers(groupid, rankid) { request(`https://groups.roblox.com/v1/groups/${groupid}/roles`, function (error, res, body) { JSON.parse(body).roles.forEach(function(array) { if(array.rank == rankid) { request(`https://groups.roblox.com/v1/groups/${groupid}/roles/${array.id}/users?limit=100&sortOrder=Desc`, function (error2, res2, body2) { return JSON.parse(body2).data }) } }) }) } app.get('/getplayers/:groupid/:rankid', function(req, res) { res.send(getPlayers(req.params.groupid,req.params.rankid)); });
You will need to install request
, you do this by opening the console and typing pnpm install request
, and then pressing enter, then put refresh
in the console and then press enter again. express
should be preinstalled.
Fill in the GroupId and RoleId, I took the liberty of getting the roleset so you don't need to, just use the ones you see on the admin page.
This will return a table per member in the role:
{ int userId, string username, string buildersClubMembershipType, }
buildersClubMembershipType
return any of the following:
'None' 'BC' 'TBC' 'OBC'
If this does not work, do not hesitate to DM me on discord @ MachoPiggies#3484!
EDIT Forgot to add the http
If you want this in your game, use game:GetService("HttpService"):GetAsync("https://projectname.glitch.me/getplayers/GROUPID/RANKID")