How to toggle shiftlock with a script?

So I have a tool, which I want shiftlock to enable when the player equips it. I tried to mess around with the player scripts and things, but it doesn’t work much. Is there a simple script which does that?

There’s already been a couple of questions like this that have been answered.