I have a question for the programmers among you; how do I make it so that a script cannot be moved beyond the monitor border?

It bothers me that HugeBag can be moved beyond the edge, I would very much like to change that.

I hope someone can help me with this.