Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is it possible to add everyone who is in a certain group rank to a table?

Asked by 4 years ago
Edited 4 years ago

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?

0
if plr:GetRankInGroup() >= x then table.insert(tbl,plr) end theking48989987 2147 — 4y
0
I need it so I would join the game then it will add everyone to the table. Because I can't get over 2k people to join the game. LEWIS1063 6 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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")

0
I sort of avoided Noblox.js as it's getPlayers() function is super unreliable and hard to use for new people. MachoPiggies 526 — 4y
Ad

Answer this question