I'm creating an admin console for a friend's clan, and when you enter the player's name in the command box, I want an underlying TextLabel to predict who the player is, or at least match the first found player. Anyways, it works pretty well like so:
Gif: GIF 1
But if I wanted to predict the name of "Jojo6565", and I put "ojo" instead of "jojo", it would still predict it, and I don't want that.
Gif: GIF 2
Here's the string manipulation code I have to get the name of the player:
string.match(string.lower(player.Name),text:sub(cmd:len() + 2).."%w+")
I guess my question is, how can I make it get the name using only the first couple of letters, and not a few letters anywhere in the player name?

1 comment
just make sure that the first couple of characters are the same before displaying them. Easy to do with just an if statement