For more context I am trying to make a typing game and the way I am doing this is by using string.find to see if what the player typed is in the text they have to write the problem with using string.find or string.match or any other type of string functions is that if they include something like a "-" or a "%" before an invalid character in the pattern part it will return nil, so I want to know if there is a way to make a string not be affected by the dashes and what not.
local WordToWrite = "oil-based" -- Do not worry how I got oil-based as it is just an example
local TextBox = script.Parent
TextBox.Changed:Connect(function()
-- If the TextBox has something like "oil-b" or "oil-ba" it would return nil which is not what I want it to do
print(string.find(TextBox.Text, WordToWrite))
if string.find(TextBox.Text, WordToWrite) then
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
else
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 70, 70)
end
end
I could just not include dashes, but I just want to know if there is a way around this before I delete any phrases including them.

1 comment
Thank you so much!!