Godot 4 Error read for something that doesn't exist

Godot Version

4.2.1

Question

I’m trying to create a mask that’ll hide part of the world, following the character’s walking path. I was doing fine, following a basic masking tutorial and an enemy chase tutorial, but then Godot tossed in an error that reads: Expected indented block for property after " : "
I understand the words, I saw the highlight line. The problem is that there is an indented block after the " : ". I save the script and scene a couple of times, the error is still there. I close the program and re-open it, the error is still there. I delete the line, the error is still there. The line number no longer even exists, the error is still there. I create a new script, start trying to rewrite the code, the error shows up on a line that doesn’t exists. It seems fine if I don’t put any “:” anywhere in the script, but I don’t really see that as a feasible option, especially when I can’t seem to use “$” to reference an Area2D node because it is a class that isn’t a node. (I was following a tutorial and that’s how he wrote it, but the tutorial is 4 years old on Godot 3.2 so I don’t know enough to register whats changed.)
Any suggestions would be appreciated.


Actually, there isn’t. An indented block is when you tabulate before starting a line, visible by the >| symbols in front. Line 8 or 9, which is highlighted in red, are not indented. But they don’t need to be. The : in line 7 is what’s causing the problem in the first place.

A : in this context acts kinda like curly brackets in other languages, which basically says “Hey, you! Everything that is indented below me? You belong to me! >:D” But you do not want the enum to be part of the playerDetectionZone. At least I don’t think so. Simply removing the : at the end of line 7 should do the trick. :>

Yeah, I’m afraid even after removing the :, you’re just gonna get other error messages thrown at you. Lots of Godot 3 code does not work with Godot 4 anymore because they changed a lot of function names and small things with the syntax.

For now you can just try the solution I have mentioned above and it should get rid of that pesky error message. >:> If you run into more errors you can post them here too and we can take a look into them. :> But it might be a bit harder to fix those. :<