I know how to make a kick script, but I am stumped on how to make it not need a full username to kick a player (chat command)
✓ ANSWER ACCEPTED
How would I make a kick script but not require the full name?
1 answer
✓ Accepted answer
Use string.match(...)
function fuzzyKick(targetName)
players = game:GetService("Players")
matches = {}
for i, v in pairs(players) do
if string.match(v.Name, targetName) then
matches[#matches + 1] = v
end
end
if #matches == 1 then
v:Kick()
elseif #matches == 0 then
-- report no matches
else
-- report multiple matches
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
