Greasy Fork is available in English.

Roblox Friend Remover

Remove all of your friends on Roblox

// ==UserScript==
// @name         Roblox Friend Remover
// @namespace    https://spin.rip/
// @version      2.0
// @description  Remove all of your friends on Roblox
// @author       Spinfal
// @match        https://www.roblox.com/users/*/profile
// @icon         https://www.google.com/s2/favicons?domain=roblox.com
// @grant        none
// @license      AGPL-3.0 License
// ==/UserScript==

(async function() {
    'use strict';

    const userID = !location.href.split('/')[4] ? prompt('User ID:') : location.href.split('/')[4];
    if (userID) {
        if (confirm('Remove all friends?')) {
            getCsrfToken().then(token => {
                console.log(token)
                alert('CSRF Token (auth) set to: ' + token);
                fetch(`https://friends.roblox.com/v1/users/${userID}/friends?sortOrder=Desc`).then(res => res.json()).then(res => {
                    res.data.forEach(user => {
                        fetch(`https://friends.roblox.com/v1/users/${user.id}/unfriend`, {
                            "headers": {
                                "accept": "application/json, text/plain, */*",
                                "accept-language": "en-US,en;q=0.9",
                                "sec-ch-ua": "\"Opera GX\";v=\"83\", \"Chromium\";v=\"97\", \";Not A Brand\";v=\"99\"",
                                "sec-ch-ua-mobile": "?0",
                                "sec-ch-ua-platform": "\"Windows\"",
                                "sec-fetch-dest": "empty",
                                "sec-fetch-mode": "cors",
                                "sec-fetch-site": "same-site",
                                "x-csrf-token": token
                            },
                            "referrer": "https://www.roblox.com/",
                            "referrerPolicy": "strict-origin-when-cross-origin",
                            "body": null,
                            "method": "POST",
                            "mode": "cors",
                            "credentials": "include"
                        });
                    })
                }).catch(e => {
                    alert('An error has occurred. Check the DevConsole for more info.');
                    console.error();
                });
            });

            function getCsrfToken() {
                return new Promise((resolve, reject) => {
                    fetch(`https://friends.roblox.com/v1/users/0/unfriend`, {
                        "headers": {
                            "accept": "application/json, text/plain, */*",
                            "accept-language": "en-US,en;q=0.9",
                            "sec-ch-ua": "\"Opera GX\";v=\"83\", \"Chromium\";v=\"97\", \";Not A Brand\";v=\"99\"",
                            "sec-ch-ua-mobile": "?0",
                            "sec-ch-ua-platform": "\"Windows\"",
                            "sec-fetch-dest": "empty",
                            "sec-fetch-mode": "cors",
                            "sec-fetch-site": "same-site",
                            "x-csrf-token": null
                        },
                        "referrer": "https://www.roblox.com/",
                        "referrerPolicy": "strict-origin-when-cross-origin",
                        "body": null,
                        "method": "POST",
                        "mode": "cors",
                        "credentials": "include"
                    }).then(data => {
                        for (let pair of data.headers.entries()) {
                            if (pair[0] === 'x-csrf-token') return resolve(pair[1]);
                        }
                    }).catch(e => {
                        alert('An error has occurred. Check the DevConsole for more info.');
                        console.error();
                    });
                });
            }
        }
    }
})();