✓ Accepted answer
string.match
The first parameter is the string, the second is the pattern you are looking for. It should be the player's Name first and the TextBox.Text second.
string.match(plr.Name, TextBox.Text)
string.match will match anywhere in the string. string.match('helloPizza', 'Pizza') will return something. Use string.sub to stop this interaction.
string.lower, string.upper
string.match is case sensitive. By making the string lowercase/uppercase, it'll compare just the letters rather than checking if upper/lower letters are matching.
local lowerName = plr.Name:lower()
local lowerText = TextBox.Text:lower()
string.match(lowerName, lowerText)
Matching Nothing
Having the string be nothing "" will match with any player. You should check if the TextBox.Text is not equal to "" before running anything. Since you are autofilling, don't think this matters.
More
Since people could have similar names, you should not autofill until there is only one person that matches the string.
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
local matchedPlayers = {}
for _,v in pairs(game.Players:GetPlayers()) do
if string.match(v.Name:lower(), script.Parent.Text:lower()) then
table.insert(matchedPlayers, v)
end
end
if (#matchedPlayers == 1) then
local autofill = matchedPlayers[1]
end
end)
Good luck!