Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Adds up the total amount of Robux in all of your groups. Made as a utility function for game devs with multiple groups.
- const userid = YOUR_USER_ID;
- const groupurl = `https://www.roblox.com/users/profile/playergroups-json?userId=${userid}`;
- let Total = 0;
- function GetRobux(id) {
- let url = `https://www.roblox.com/my/groupadmin.aspx?gid=${id}`;
- return new Promise((resolve, reject) => {
- try {
- fetch(url, {
- credentials: 'same-origin'
- }).then((response) => response.text()).then((data) => {
- try {
- resolve(Number(data.match(/e-amount">[\d,,]*/g)[0].replace('e-amount">', '').replace(/,/g, '')));
- } catch(e) {
- resolve(0);
- };
- });
- } catch(e) {
- resolve(0);
- };
- });
- };
- fetch(groupurl).then((response) => response.json()).then(async (data) => {
- for(let group of data.Groups) {
- let Amount = await GetRobux(group.Id);
- Total += Amount;
- };
- console.log('Total: ' + new Intl.NumberFormat().format(Total) + ' ($' + Total * 0.0035 + ')');
- });
Advertisement
Add Comment
Please, Sign In to add comment