So if a player had 'Xx' in there name, anywhere in there name, they'd get kicked when'd they try to join the game. Is this possible or not?
✓ ANSWER ACCEPTED
Is it possible to kick a player from your game if their name contains a set word?
1 answer
✓ Accepted answer
Yes. Not sure of this purpose though... Kind of discrimination...
function check(p)
local maxCombo = string.len(p.Name) - 1 -- How many possible combinations where 'Xx' could be
local i = 0 -- Current combo
while true do -- A loop, to go through all combos
if i == maxCombo then -- Searched all possible combinations, stop trying
return false
end
local current = string.sub(p.Name, i + 1, i + 3) -- Grab combo that we are checking
if string.lower(current) == "xx" then -- If our current combo matches, stop checking, return positive
return true
end
i = i + 1 -- Move to the next combo
end
end
check(game.Players.XxNamexX) -- > true
check(game.Players.H4X0MSYT) -- > false
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thank you, much appreciated. Also, Xx was just the first example that popped into my head. I was just planning on using this to kick people who have sort clan names. Such as EXAMPLE_Doggo, so on.. But, once again thank you
Would string.contains() or string.find("Hello my friend":lower(), "hello") not be a much simpler job than rolling-your-own string search? A good string search is pretty hard to write.