The code below is supposed to get all the Items, (separated by a comma and then space.)
But instead, I typed in Gu, Swor, (which should have printed Gun and Sword), and it printed only Gun. (luckily it was successful if I typed in one item)
local function getItems(String)
local Table = String:split(", ")
for i, v in pairs(Table) do
for i, Item in pairs(game.ReplicatedStorage:WaitForChild("Items"):GetChildren()) do
if string.sub(string.lower(Item.Name), 1, string.len(v)) == string.lower(v) then
return Item.Name
end
end
end
end
script.Parent.FocusLost:Connect(
function()
local Items = getItems(script.Parent.Text)
if Items then
print(Items)
end
end
)
What did I do wrong?

2 comments
nice
damn thanks man