Bone roll angle lock issues

I have an IK chain set up with 4 chain bones plus a null at the end, and I want to lock the rotation of the first four bones on their z-axis. Still, when i move the IK chain around it acts as if there is no rotation constraint on it. The only thing I’ve managed to restrict are y-rotational limits between a certain range. When I used a different set up with the “automatic IK” option it worked, but I can’t really use this for my rig. Any solutions? Thanks.

You would have to use the Root Bone (the first one that was created) as an anchor by Locking XY and Z on it and add an extra bone (your second one now becomes your first in the chain.