Hey, how would I target a player without using their full name? Eg if I type "kill tack" it will do the same thing as typing "kill tacktic2010"
You could check if the name starts with what you want:
1 | local function FindPlayer(name) |
2 | name = name:lower() -- "AbcGG" becomes "abcgg" |
3 | for k,v in pairs (game:GetService( "Players" ):GetPlayers()) do |
4 | -- "MrSomebody" becomes "mrsom" if 'name' is 5 characters long |
5 | if v.Name:lower():sub( 1 ,#name) = = name then |
6 | return v -- found the player, return it |
7 | end |
8 | end |
9 | end |
Now you can do FindPlayer("tack") to find Tacktic2010.
1 | local function FindPlayer(name) |
2 | name = name:lower() |
3 | for k,v in pairs (game:GetService( "Players" ):GetPlayers()) do |
4 | if v.Name:lower():match( "^" ..name) then |
5 | return v |
6 | end |
7 | end |
8 | end |
Just for those wondering this is another way of doing it, thanks Pyro! <3