Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a kick script but not require the full name?

Asked by 6 years ago

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)

1 answer

Log in to vote
0
Answered by
fredfishy 833 Moderation Voter
6 years ago
Edited 6 years ago

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
Ad

Answer this question