Garry's Mod Wiki


  boolean Entity:SetSaveValue( string name, any value )


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.

This does not type-check entity keys. Setting an entity key to a non-entity value will treat it as NULL.

Issue Tracker: 4065


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


1 boolean
Key successfully set


Make all rollermines currently on the map friendly

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