variable can be seen fine in one function but not another?

I’m making a swep which spawns props for a gamemode I’m working on and I want to get change the scrolling text on the tool gun to the prop I currently have selected.
I have it where on left click it spawns the prop and right click it changes your prop to the next prop in the list. So I have this in my primaryAttack()



ent:SetModel (PROPLIST[self.CProp].MODEL)


As you can see it goes the the proplist and grabs the correct model based on CProp. My secondary attack just increments CProp. If I print out CProp to console at the time I exectute secondary attack I can see that it is in fact incrementing properly.
Now onto the scrolling text. I just grabbed garrys code from cl_viewscreen.lua and changed the text it displayed to PROPLIST[self.CProp].NAME. It properly displays the scrolling text for the first prop I have selected but it doesnt change when I use my secondary attack. I have figured out it’s because the self.CProp never changes in the function that does the scrolling text. It is always 1. How can that be? In one function it changes properly but the other it doesnt?
Anyone know why this might be?

Also when I first run the game I get this error.
shared.lua:301: attempt to call global ‘Material’ (a nil value)

That is the material for the screen on the toolgun. Is that causing all my problems?

[editline]07:26PM[/editline]

Now that I think of it, I think that error is causing all my problems as everything below that doesnt work then. So I guess the question is, why does this line not work?



local matScreen 	= Material( "models/weapons/v_toolgun/screen" )


[editline]07:47PM[/editline]

Arghh. Well while writing this thread I figure it out pretty much.
That is obviously throwing an error since it is in shared and can only be clientside. Now I just need to figure out how to change the text on the client. Either a get function or msg.

**[Entity.SetNetworkedString

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

I got it to work with a convar. Would NetworkedString be better?
So this is kinda what I did.
On the serverside under deploy() I put



CreateConVar( "CPropName", PROPLIST[self.CProp].NAME, {FCVAR_REPLICATED, FCVAR_CHEAT})


And in SecondaryFire() after I switched my prop I did this:



self.Owner:ConCommand("CPropName "..PROPLIST[self.CProp].NAME)


then in the client code when I rendered the screen I did this:



local name 	= GetConVar( "CPropName" ):GetString()