Garry's Mod Wiki

Entity:GibBreakClient

Entity:GibBreakClient( Vector force, table clr = nil )

Description

Causes the entity to break into its current models gibs, if it has any.

You must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs.

If called on server, the gibs will be spawned on the currently connected clients and will not be synchronized. Otherwise the gibs will be spawned only for the client the function is called on.

Note, that this function will not remove or hide the entity it is called on.

For more expensive version of this function see Entity:GibBreakServer.

Arguments

1 Vector force
The force to apply to the created gibs.
2 table clr = nil
If set, this will be color of the broken gibs instead of the entity's color.

Example

A console command that breaks the prop the player is aiming at when they runt he command.

concommand.Add( "break", function( ply ) local tr = ply:GetEyeTrace() local ent = tr.Entity if ( !IsValid( ent ) ) then return end -- playing not looking at any entity, bail ent:PrecacheGibs() ent:GibBreakClient( tr.HitNormal * 100 ) -- Break in some direction end )

Page Links


Special Pages


Wikis

?

Render Time: 36ms

DB GetPage 3
Generate Html 10
SaveChanges 9
Render Body 0
Render Sidebar 11