Okay, I went into Godot, copied the shader code from the screenshot, copied the script and made a few changes to the script to get it working with my scene.
However, it appears the issue was not the code and how it was changing the shader, though the range in the script was too large for good results, but rather the shader in the screenshot does not transition nicely between values. It seems to only work with really, really small values, which limits the range you can use.
However, I found a Reddit post where a user called fleurInestimable posted a shader that turns a high resolution sprite into a lower, more pixel filled version. I made a few small changes to the shader so it works with the screen texture, and then changed the range in the script and it all works now. Now when you press space/enter, it transitions from a non-pixel version to a pixel version.
I have attached the project I used. Hopefully it helps :smile: