Garry's Mod Wiki

Entity:GetFlexNum

  number Entity:GetFlexNum()

Description

Returns the number of flex controllers this entity's model has.

Please note that while this function can return the real number of flex controllers, the game supports only a certain amount due to networking limitations. See Entity:SetFlexWeight.

Returns

1 number
The number of flexes.

Example

Draws all flex controller names and their values of the local player on the screen.

hook.Add( "HUDPaint", "draw_all_flexes", function() local p = LocalPlayer() for i=0, p:GetFlexNum() - 1 do draw.SimpleText( tostring( i ) .. " - " .. p:GetFlexName( i ) , "Default", 50, 50 + i * 10, color_white ) draw.SimpleText( ("%0.3f"):format( p:GetFlexWeight( i ) ), "Default", 250, 50 + i * 10, color_white ) end end )
Output: For default player model with flexes:
image.png