Garry's Mod Wiki

Entity:SetSaveValue

  boolean Entity:SetSaveValue( string name, any value )

Description

Sets a save value for an entity. You can see a full list of an entity's save values by creating it and printing Entity:GetSaveTable().

See Entity:GetInternalVariable for the opposite of this function.

Arguments

1 string name
Name of the save value to set
2 any value
Value to set

Returns

1 boolean
Key successfully set

Example

Make all rollermines currently on the map friendly

for i, mine in ipairs( ents.FindByClass( "npc_rollermine" ) ) do mine:SetSaveValue( "m_bHackedByAlyx", true ) end