Garry's Mod Wiki

ents.CreateClientProp

  Entity ents.CreateClientProp( string model = "models/error.mdl" )

Description

Creates a clientside only prop with optional physics. See also ClientsideModel if physics is not needed.

For physics to work you must use the model argument, a simple SetModel call will not be enough.

Parented clientside prop will become detached if the parent entity leaves the PVS. A workaround is available on its github page.

Issue Tracker: 861

Arguments

1 string model = "models/error.mdl"
The model for the entity to be created.

Returns

1 Entity
Created entity (C_PhysPropClientside).

Example

Creates a clientside prop at the player location.

function GhostBarrel( ply ) local c_Model = ents.CreateClientProp() c_Model:SetPos( ply:GetPos() ) c_Model:SetModel( "models/props_borealis/bluebarrel001.mdl" ) c_Model:SetParent( ply ) c_Model:Spawn() end

Example

Creates a clientside prop with physics.

concommand.Add( "testent", function( ply ) local plyTr = ply:GetEyeTrace() local csEnt = ents.CreateClientProp( "models/props_combine/combine_light001b.mdl" ) csEnt:SetPos( plyTr.HitPos + plyTr.HitNormal * 24 ) csEnt:Spawn() end )