SOLVED: So, apparently, InputChanged is fired first, and then added to the textbox, right? So, when I went to string:match, it would match the text BEFORE the new letter was being added. So When you to go match "TACO", it would only match "TAC", because that is what the Text is.
Ok, so I know that there are a lot of reasons why some things work in Client and not in Server, but I don't see how this could be part of that.
local UI = game:GetService("UserInputService")
local TheFlavors = nil
local TheRecipe = nil
local FoundItemName = nil
UI.InputBegan:connect(function(Input,GP)
if (UI:GetFocusedTextBox()) == TextBox then
TheFlavors = nil
TheRecipe = nil
local Matches = 0
for MainitemName,Item in pairs (Recipe) do
if Matches ~= "D" then
for i,ItemName in pairs (Item.Names) do
if string.lower(ItemName) == string.lower(TextBox.Text) then
Matches = "D"
if Item.Recipe then
TheRecipe = Item.Recipe
end
if Item.Flavors then
TheFlavors = Item.Flavors
end
FoundItemName = MainitemName
break
elseif string.lower(ItemName):match(string.lower(TextBox.Text)) then
Matches = Matches+1
if Matches == 1 then
if Item.Recipe then
TheRecipe = Item.Recipe
end
if Item.Flavors then
TheFlavors = Item.Flavors
end
FoundItemName = MainitemName
end
end
end
end
if Matches == 0 then
TextBox.BorderColor3 = Color3.new(156/255, 79/255, 79/255)
TextBox.Flavors.Visible = false
TextBox.Recipe.Visible = false
elseif Matches == 1 or Matches == "D" then
TextBox.BorderColor3 = Color3.new(82/255, 200/255, 84/255)
if TheFlavors then
TextBox.Flavors.Visible = true
end
if TheRecipe then
TextBox.Recipe.Visible = true
end
elseif Matches > 1 then
TextBox.BorderColor3 = Color3.new(15/255,15/255,15/255)
TextBox.Flavors.Visible = false
TextBox.Recipe.Visible = false
end
end
end
end)
If you type "Taco" in Client, it turns green.
if you type "Taco" in Server, it doesn't work. BUT, if you type "Tacoo" in server, it turns green. WHYYY?
