Help with a script

So Iam Using this code in a swep
if ply:Crouching() then
self.Owner:SetMaterial(“engine/occlusionproxy”)
So Iam trying to make it when you crouch even without holding the weapon out you go invisible
I seem to not be getting any lua errors but it does not seem to be setting the players material either

You have to set the swep owner first if I am right.

In a think hook outside of the SWEP, check if the player is crouching and they don’t have that material set.

I dont know how to do that sadly