So I made a module script that has a function :GetPass(len) that returns a random string of upper and lowercase letters, numbers, and special characters like %.
local pass = {}
local chars = {"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","#","$","%","^","@","&","*","-","_","!","~"}
local max = 10000 --Max amount of characters, 10000 is the recommended so that it won't take forever to generate.
function pass:GetPass(len)
local Pass = ""
if len >= max then
return false
end
for i = 1, tonumber(len), 1 do
wait() --Needed for long password or lower-end computers. Otherwise, it would try to do it super fast and would cause problems if it is a long pass.
local cap = math.random(1,2)
local char = math.random(1,2)
local num = math.random(1,9)
if char == 1 then
if cap == 1 then
Pass = Pass..string.upper(chars[math.random(1,#chars)])
else
Pass = Pass..string.lower(chars[math.random(1,#chars)])
end
else
Pass = Pass..num
end
end
Pass = chars[math.random(27,#chars)]..Pass..chars[math.random(27,#chars)]
return Pass
end
return pass
But then I read an article: https://developer.roblox.com/en-us/articles/Text-and-Chat-Filtering that made me think that I should filter the random string to make sure it doesn’t make any inappropriate message on accident. How would I do that, because Text Service says it requires a user id. And the filtered text dose not come from player input. So how would I filter it.