Hi,
So I'm making admin commands for my game. I want it so that ';kill noob' is the same as ';kill noob123'. I am curently using workspace:FindFirstChild(plr) (player is the first argument of the command). I know that it it will be something like:
if workspace:FindFIrstChild(game.Players:findFirstChild(str.find(plr), plr))
or something more complicated by going through each player in the game.Players
to see if their name includes that, and if it does set the plr
variable to the full name.
Whatever it is, I really need help. Anything would be greatly appreciated.
-Bizz
function searchPlayer(searchName) searchName = "^"..searchName:lower() --Pattern in lowercase and ^ for searching at the beggining for _, plr in pairs(game:GetService("Players"):GetPlayers()) do local plrName = plr.Name:lower() --Lowercase the player name if plrName:find(searchName) then --Make the search and return the player if it's true return plr end end end searchPlayer("Holies")