You make a table, which has all the letters which are allowed in this random name. (e.g. Alphabet and Numbers)
You then use math.random() to generate random numbers which you will use to pick random letters/numbers/symbols from the table.
local alphabet = {}
local characters = 12 -- The amount of characters this name should have
local function randomString()
local String = ""
local num = 0
repeat
num += 1
String = String..alphabet[math.random(1, #alphabet)]
until num == characters
return String
end
print(randomString())
You can use HttpService to generate a UUID (universally unique identifier) that is guaranteed to be unique.
local HttpService = game:GetService("HttpService")
local result = HttpService:GenerateGUID(true)
print(result) --> Example output: {04AEBFEA-87FC-480F-A98B-E5E221007A90}
local random = math.random
local char = string.char
local function randomstring(length)
length = length or random(8, 16)
local str = ""
for ind = 1, length do
if random(1,2) == 1 then
str = str .. char(random(65, 90))
else
str = str .. char(random(97, 122))
end
end
return str
end
for i_edited_this_like_four_times = 1, 10 do
Instance.new("Hint", workspace).Name = randomstring(12)
end