Is it possible to have an error in a code (with the red line under the code) and it still works?
Yes, it's possible.
For example, if you surround the thing with pcall()
then if that part fails then your whole script won't crash. Otherwise, the script with the error in it will crash, but not other scripts that don't have the error.