Hmm… The first problem is you need to convert the screen position into -1 to +1 coordinates. In other words: you should be dividing by the window size in there somewhere.
Next, what is the “screen” Z position you are using? The way you are using it in the code, it’s a distance from the camera in the view direction, but what you seem to want for your actual game is a point on a 3D plane, so those two things don’t match up.
Otherwise your math looks right.
[Edit:] Rendercam needed to modify the render script to manage its own view & projection matrices, among other things. With the very recent updates to the built-in camera, you can now get the matrices from the camera component (as I see you are doing), so you shouldn’t need to modify the render script at all. Of course these matrices will still be out of date if you moved or rotated the camera that frame (also an issue with Rendercam).