Garry's Mod Wiki


  Entity:SetNWEntity( string key, Entity value )


Sets a networked entity value on the entity.

The value can then be accessed with Entity:GetNWEntity 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 Entity value
The value to set


This will set the networked entity 'owner' on all clients to themselves.

for i, ply in ipairs( player.GetAll() ) do ply:SetNWEntity( "owner", ply ) end