Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does anyone know how to make this auto fill text box?

Asked by 4 years ago
Edited 4 years ago

https://prnt.sc/stz86f

1 answer

Log in to vote
0
Answered by 4 years ago

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:

01function getPartlyMatching(searchString, list)
02    local result = {}
03 
04    for _, item in pairs(list) do
05        local itemName = tostring(item)
06        if string.find(itemName, searchString, 1, true) then
07            table.insert(result)
08        end
09    end
10 
11    return result
12end

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.

0
Thanks! That should help! FireSam5163 22 — 4y
Ad

Answer this question