You have a “pass” keyword after the _physics_process method declaration. This means that the rest of the code will not be part of the function. Also, the rest of the code seems to be not indented, so Godot thinks that the If statement is not inside a function.
So:
delete “pass” keyword
indent variable declaration and if statement.
add something after the if statement or it will still through an error
You’ve made 4 threads on these these few lines of code now. Did you try any of these recommendations? Please elaborate, what “didn’t work”, what does your code look like now? What do you want your code to do?
Don’t waste your time with this person, is the case of a person that watch a 15m tutorial and thinks: “Now i can do games!”. I already said for this person he needs to learn the basics before attempt do a game, don’t know the very basics like what’s scope, indetation, etc.
It’s really difficult to help when you don’t cooperate and keep responding with ‘it doesn’t work’. We’re not mind readers. Until you post the entire script, no one will likely be able to do anything about it.