Garry's Mod Wiki

Entity:GetRagdollOwner

  Entity Entity:GetRagdollOwner()

Description

Returns the entity which the ragdoll came from. The opposite of Player:GetRagdollEntity.

Returns

1 Entity
The entity who owns the ragdoll.

Example

Loop through all player ragdolls and print their owners (clientside).

for _, ent in ipairs( ents.FindByClass( "class C_HL2MPRagdoll" ) ) do if ( IsValid( ent:GetRagdollOwner() ) ) then print( ent:GetRagdollOwner() ) end end
Output: While a player is dead and their ragdoll is spawned this returns:

Player [1][PlayerName]