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 a player's children if you would like to prevent transmission for players. See Entity:GetChildren.
This does not work for nextbots unless you recursively loop their children and update them too.

Issue Tracker: 1736
When using this function, Entity:SetFlexScale will conflict with this function. Instead, consider using Entity:SetFlexScale on the client.

Arguments

1 Player player
The player to stop networking the entity to.
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