Garry's Mod Wiki

Entity:SetNWString

  Entity:SetNWString( string key, string value )

Description

Sets a networked string value on the entity.

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

There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2String. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage
Running this function clientside will only set it for the client it is called on.

Arguments

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

Example

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"