Widget button to take screenshot

I have assigned a buttonto take a screenshot. While in editor it works. In Runtime it doesn’t.

Is there something I am missing?