Revision Difference
Entity:SetPreventTransmit#561816
<function name="SetPreventTransmit" parent="Entity" type="classfunc">
<description>
Prevents the server from sending any further information about the entity to a player.
<note>You must also call this function on a player's children if you would like to prevent transmission for players. See <page>Entity:GetChildren</page>.</note>
<bug issue="1736">This does not work for nextbots unless you recursively loop their children and update them too.</bug>
<validate>When using this function, <page>Entity:SetFlexScale</page> will conflict with this function. Instead, consider using <page>Entity:SetFlexScale</page> on the client.</validate>
</description>
<realm>Server</realm>
<args>
<arg name="player" type="Player">The player to stop networking the entity to.</arg>
<arg name="player" type="Player" alttype="CRecipientFilter">The player to stop networking the entity to. Can also be a <page>CRecipientFilter</page> as of March 2024 to affect multiple players at once.</arg>
<arg name="stopTransmitting" type="boolean">true to stop the entity from networking, false to make it network again.</arg>
</args>
</function>
<example>
<description>This will loop through all children entities of the ent passed and stop networking them too. Works with nextbots/players</description>
<code>
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
</code>
</example>