Garry's Mod Wiki

Entity:SetPreventTransmit

  Entity:SetPreventTransmit( Player player, boolean stopTransmitting )

Description

Prevents the server from sending any further information about the entity to a player.

You must also call this function on all entity's children. See Entity:GetChildren.

issue tracker

Entity:SetFlexScale and other flex/bone manipulation functions will create a child entity.

Arguments

1 Player or CRecipientFilter player
The player to stop networking the entity to. Can also be a CRecipientFilter or a table as of March 2024 to affect multiple players at once.
2 boolean stopTransmitting
true to stop the entity from networking, false to make it network again.

Example

This will loop through all children entities of the ent passed and stop networking them too. Works with nextbots/players

function RecursiveSetPreventTransmit( ent, ply, stopTransmitting ) if ( ent ~= ply and IsValid( ent ) and IsValid( ply ) ) then ent:SetPreventTransmit( ply, stopTransmitting ) local tab = ent:GetChildren() for i = 1, #tab do RecursiveSetPreventTransmit( tab[ i ], ply, stopTransmitting ) end end end