Changing a texture

I have a model that I made, one of the parts is using the texture base.vtf. I have another texture whose filename is firststatus.vtf. Could somebody give me some lua code to change that texture? This is an entity, so I would like to replace a texture on the entity’s model.

**[Entity.SetMaterial

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.SetMaterial)**

[lua]Material(“models/mine/base”):SetMaterialTexture("$basetexture", Material(“models/mine/firststatus”):GetMaterialTexture("$basetexture"));[/lua]
Clientside, you need VMTs for each of them.
If you have a secondstatus, replace the base material again, not the firststatus’s. This will overwrite the material, so if you ever want it to go back to base, you gotta keep a spare copy of it.

Ok, thanks for the quick replies, I’ll get on that as soon as my model decides to work

UPDATE;
Ok, when I try to run it I get an error attempt to call global ‘Material’ a nil value

Oh wait, I’m stupid… I was trying to do this in the server, not the client. It changes the texture, but to the black&white error texture. I have vmts and vtfs for both textures.