Garry's Mod Wiki

Revision Difference

Player:SetPlayerColor#512438

<function name="SetPlayerColor" parent="Player" type="classfunc">⤶ <description>Sets the player model's color. The part of the model that is colored is determined by the model itself, and is different for each model.</description>⤶ <realm>Shared</realm>⤶ <args>⤶ <arg name="Color" type="Vector">This is the color to be set. The format is Vector(r,g,b), and each color should be between 0 and 1.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>When a player spawns their color will be red.</description>⤶ <code>⤶ function GM:PlayerSpawn( ply )⤶ ply:SetPlayerColor( Vector(1,0,0) )⤶ end⤶ </code>⤶ ⤶ </example>⤶ ⤶ ⤶ <example>⤶ <description>A function you could use to set the player's color to a <page>Global.Color</page> rather than a <page>Vector</page></description>⤶ <code>⤶ local function SetColor( ply, color )⤶ ply:SetPlayerColor( Vector( color.r / 255, color.g / 255, color.b / 255 ) )⤶ end⤶ </code>⤶ ⤶ </example>