Seems like you want to autocomplete player names?
If you have some string that you want to autocomplete to a list of player names, you can see which player names match like so:
01 | function getPartlyMatching(searchString, list) |
04 | for _, item in pairs (list) do |
05 | local itemName = tostring (item) |
06 | if string.find(itemName, searchString, 1 , true ) then |
Look up the docs for string.find if that part doesn't make sense to you.
You can then generate a GUI list that shows every matching player, which a button that players can click to automatically fill in the search box.