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"
✓ ANSWER ACCEPTED
Targeting Players without Full Name?
2 answers
✓ Accepted answer
You could check if the name starts with what you want:
local function FindPlayer(name)
name = name:lower() -- "AbcGG" becomes "abcgg"
for k,v in pairs(game:GetService("Players"):GetPlayers()) do
-- "MrSomebody" becomes "mrsom" if 'name' is 5 characters long
if v.Name:lower():sub(1,#name) == name then
return v -- found the player, return it
end
end
end
Now you can do FindPlayer("tack") to find Tacktic2010.
local function FindPlayer(name)
name = name:lower()
for k,v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Name:lower():match("^"..name) then
return v
end
end
end
Just for those wondering this is another way of doing it, thanks Pyro! <3
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
Thank you so much :) That was the perfect answer!
That would work, but if there are multiple matches, it'd return the first one.
Well you could return a table with all found players if you want to.
It isn't very often that people have similar names on roblox, even if they do I can just write out more of the name so it is fine :)
Yeah, only time it would be an issue is if "Someone123" and "Someone12345" are both in-game