Garry's Mod Wiki


  Entity:SetNWString( string key, string value )


Sets a networked string value on the entity.

The value can then be accessed with Entity:GetNWString both from client and server.

Running this function clientside will only set it for the client it is called on.


1 string key
The key to associate the value with
2 string value
The value to set, up to 199 characters.


Sets a networked string with a key of "Nickname" and a value of "John" on a player.

player:SetNWString( "Nickname", "John" ) print( player:GetNWString( "Nickname" ) )
Output: "John"