Script doesn,t work, view template filter

First, is it possible to change the visibility like that?
Secondly, if yes, what can I do to make it work?

What’s the error you are getting?

Can you try with an out of the box node instead of design script? There may be a few different issues here but using the node will likely help resolve this faster.