Variable loses value after ToText

Well. I’m getting “Variable not in scope” error on the image and totext part.