SetBodygroups on player

Hi! im struggling to set the bodygroup on a player, would it be this for sure?



ply:SetBodygroup( 1, 14 )


because that does nothing…

Show us your full code



function BGTest( ply )

	ply:SetBodygroup(1, 14 ) 
end
concommand.Add("ChangeBodygroup",BGTest)


check if the bodygroup is correct. Use http://wiki.garrysmod.com/page/Entity/GetBodyGroups

so like this maybe, not to sure what you mean by correct



function BGTest( ply )
if ply:GetBodygroup(1) == true then
ply:SetBodygroup(1,14)
end
end


Read the wiki page, the function returns a table of bodygroups on the entity, you are using it incorrectly

ok, well i looked at it and i have no idea how to check if the bdoygroup is correct



local function BGTest( ply )
	local bodyGroups = ply:GetBodyGroups()

	PrintTable( bodyGroups )
end
concommand.Add( "ChangeBodygroup", BGTest )


Post results of what it prints into the console

thanks, i was using the normal print and this is what it printed



1:
		id	=	0
		name	=	male_02
		num	=	1
		submodels:
				0	=	male_01_shirt_reference.smd
2:
		id	=	1
		name	=	body
		num	=	6
		submodels:
				0	=	male_01_shirt_closedcollar_black.smd
				1	=	male_01_shirt_closedcollar_short_black.smd
				2	=	male_01_shirt_closedcollar_rolled_black.smd
				3	=	male_01_shirt_opencollar_black.smd
				4	=	male_01_shirt_opencollar_short_black.smd
				5	=	male_01_shirt_opencollar_rolled_black.smd


Now you can see what body groups are available. Now go back to your original code and use the information you haven now found. I’d assume the bodygroup is 1 and the value is between 0 and 6, you were originally setting it to 12

that still doesnt work for me…

[editline]14th May 2015[/editline]

never mind its working now thanks!