I’ve got a net message going from server->client that writes an entity, but when it’s received client-side the entity is Null - The entity itself is a nextbot I created:
function Hint:ClientCreate( target ) net.Start( "GAME_Hint_Create" ) if isentity( self:GetTrigger() ) then print( "IS ENTITY" ) print( self:GetTrigger() ) net.WriteEntity( self:GetTrigger() ) end net.Send( self:GetTargets() ) end
> IS ENTITY > NextBot [npc_marshal]
function hint.Create() print( "Creating locally" ) local trigger = net.ReadEntity() print(trigger) end net.Receive( "GAME_Hint_Create", hint.Create )
> Creating locally > [NULL Entity]
[editline]6th February 2017[/editline]
As I was doing this on spawn, the entity hadn’t been created client-side yet, so adding a 0.1 second delay fixed this.