· 6 years ago · Jan 12, 2020, 01:52 PM
1 I made a script that can be used to generate untaken roblox names (It is scripted to get 4 char names).
2I don't know if this works with exploits or not, I've been testing it in roblox studio (as a server script).
3Note: It just alerts you in dev console that the name is not taken, it doesn't actually create the account for you.
4
5There are some variables at the beginning you can set to change results (I don't know if the underscore variable works or not, lmao). I recommend keeping numbers enabled as no number-names are rare, haven't gotten any finds
6
7After I finished I realized I could make a table with all possible four char combinations, rather than using a cache and a math.random() on a random index of a table full of characters, I'm gonna post this post and then try and work on that. Was running this for a while and all of a sudden 8char names start popping up, I made an oopsies somewhere, i think i added a fix but not sure if it works.
8
9no bulli for how i script pls
10
11https://developer.roblox.com/en-us/api-r...mNameAsync this is the roblox API that I use in the script
12
13
14
15Cons (so far):
16
17It is slow.
18Sometimes the username is inappropriate and cannot be used, but will show up since there is no user with that name
19
20
21Code:
22players = game:GetService("Players");
23
24
25underscoreOkay = true; -- change to true if you want an underscore visible in the username, false if you don't want them there', this may be broke, idk
26
27numbersOkay = true; -- change to true if you want numbers visible in username, false if you dont want them there
28
29nameLength = 4; -- 4 char usernames will be attempted to be generated (This value can be changed)
30
31
32charTable = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; -- list of characters
33
34
35
36if (underscoreOkay == true) then
37table.insert(charTable, "_"); -- insert underscore for generation, there will be hard check in generation to make sure this can only be used once
38end;
39
40if (numbersOkay == true) then
41for i = 0,9 do
42table.insert(charTable, tostring(i)); -- insert each number into table for generation
43end;
44end;
45
46local cache = {};
47
48
49function generateRandom() -- this abomination made sense to me when i scripted it
50local ret = ""; -- this will store the username
51
52repeat wait() -- this nasty critter is needed so the nasty repeat doesnt crash us
53local isDone = false;
54for i = 1,nameLength do
55local nextChar;
56local underscoreAmount = 0;
57local underscoreDone = false; -- this will help with underscore checks; if it is true, an underscore has already been used
58repeat
59wait(); -- this nasty critter is needed so the nasty repeat doesn't crash us
60local isDoable = false;
61nextChar = charTable[math.random(1, #charTable)];
62if (underscoreAmount == 0 and nextChar == "_" and underscoreDone == true or nextChar == "_" and i ~= 1 or nextChar == "_" and i ~= nameLength) then -- if char position == last or first position and nextChar is underscore, of if underscore has been used once
63-- I think I made logic error somewhere in these comparisons but it seems to work
64underscoreAmount = 1;
65underscoreDone = true;
66else
67isDoable = true;
68end
69until isDoable == true;
70ret = ret .. nextChar; -- append the randomly generated character to the returning string.
71end;
72
73if (cache[ret] == nil and ret:len() == 4) then -- if the name has already been used in the generation, repeat the loopity loop
74cache[ret] = true; -- it is now in the cache
75isDone = true; -- end the loop
76end
77until isDone == true;
78
79return ret;
80end;
81
82
83function checkPlayer(name)
84local bet = "_";
85local isPlayer = false;
86local x, y = pcall(function()
87bet = players:GetUserIdFromNameAsync(name);
88end);
89
90if (y == nil) then
91isPlayer = true; -- there is no need to set it to false in an else statement as it is already false.
92end;
93
94return (isPlayer); -- return boolean of whether the username exists or not. If username exists, return true, if it does not, return false
95end;
96
97while wait() do -- will exe 100 times, will probably only give off like 5 results idk
98local newName = generateRandom();
99if (checkPlayer(newName) == false) then
100print("Untaken name: " .. tostring(newName)); -- THIS WILL WARN THE USERNAME IF IT IS NOT TAKEN
101end;
102end;