Swep material

I am trying to change the material on the Glock in my swep.

Here is my code.

[lua]
function SWEP:Initialize()
if ( SERVER ) then
self:SetWeaponHoldType( “pistol” )
end
if ( CLIENT ) then
self:SetMaterial(“path/to/material”)
end
end
[/lua]

It just loads the Glocks material.

If that’s in init.lua then the client can’t access it. Try letting the server run it?

self.Owner:GetViewModel( ):SetMaterial( “path/to/material” )

The sticky said to search before posting a new thread, so i did.

That doesn’t seem to work for me. Either that or I’m doing it wrong. I’m finding lua difficult to learn. Can someone help me?

[editline]4th January 2012[/editline]

Oh, it’s working now. Except every texture on the viewmodel is using the one texture. Oh, and all my other sweps have that same texture too.

:zoid: