For indentation errors make sure to paste code with proper formatting.
Generally you will need to add indentation for code you want to be part of the function or if statement.
# not part of function
# function start
func _ready() -> void:
# part of _ready()
print("hi from ready!")
# part of _ready and starting a if block
if false:
# part of the if block, shouldn't print
print("nobody will see this")
# no longer part of if block
print("hello again from ready, where is that last print?")
# no longer part of the function, script ends too.