• SetBodygroups on player
    10 replies, posted
Hi! im struggling to set the bodygroup on a player, would it be this for sure? [CODE] ply:SetBodygroup( 1, 14 ) [/CODE] because that does nothing...
Show us your full code
[CODE] function BGTest( ply ) ply:SetBodygroup(1, 14 ) end concommand.Add("ChangeBodygroup",BGTest) [/CODE]
check if the bodygroup is correct. Use [url]http://wiki.garrysmod.com/page/Entity/GetBodyGroups[/url]
so like this maybe, not to sure what you mean by correct [CODE] function BGTest( ply ) if ply:GetBodygroup(1) == true then ply:SetBodygroup(1,14) end end [/CODE]
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
[code] local function BGTest( ply ) local bodyGroups = ply:GetBodyGroups() PrintTable( bodyGroups ) end concommand.Add( "ChangeBodygroup", BGTest ) [/code] Post results of what it prints into the console
thanks, i was using the normal print and this is what it printed [CODE] 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 [/CODE]
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!
Sorry, you need to Log In to post a reply to this thread.