Can't see my hands when running simple script


local ply = FindMetaTable( "Player" )

--[[ Teams Tables ]]--

local teams = {}

teams[1] = { name = "Citizen", weapons = { "weapon_physcannon", "weapon_physgun" }, model = { "models/player/group01/male_07.mdl" } }

function ply:SetGamemodeTeam( n )

	if not teams[n] then return end
	
	self:SetTeam( n )
	
	return true

end

function ply:GiveGamemodeItems()

	local n = self:Team()
	
	self:StripWeapons()
	self:RemoveAllAmmo()
	
	for k, wep in pairs( teams[n].weapons ) do
	
		self:Give( wep )
	
	end
	
	for k, mod in pairs( teams[n].model ) do
	
		self:SetModel( mod )
	
	end
	
end


SetGamemodeTeam is called in initial spawn

GiveGamemodeItems is called in player spawn

I can see my friend’s model just fine, but i don’t have hands. Any ideas?

Add weapon_fists… Also, are you setting SWEP.UseHands = true; ?

Here’s the tutorial on it: http://wiki.garrysmod.com/page/Using_Viewmodel_Hands

I mean that when i hold my physgun, i can’t see my physical hands in game. Like my physgun is just floating there.

[editline]22nd February 2015[/editline]

Nevermind, i fixed it. Thanks for the link

Yes; the tutorial is the old method of doing things if I recall correctly but you should be able to get away with only setting ply:SetupHands( ); in PlayerSpawn… but Robot knows the specifics… I don’t think I’ve updated my GM with the new method yet but I’m scanning to see…

Found it:

This is the old method and it was ugly so I put it all into one file… SHARED…


//
// New Hands System - All that's needed
//
if ( SERVER ) then
	hook.Add( "PlayerSpawn", "PlayerSpawn:NewHands", function( _p )
		//
		// Player Class Method - If you want to use the player-class method, uncomment this, and comment out the spawning it in method.
		//
		-- player_manager.SetPlayerClass( _p, "player_dev" ); // player_default
		-- player_manager.OnPlayerSpawn( _p )
		-- player_manager.RunClass( _p, "Spawn" )

		//
		// ViewModel HANDS Spawning it in method
		//
		local _old_hands = _p:GetHands( );
		if ( IsValid( _old_hands ) ) then _old_hands:Remove( ); end

		local _hands = ents.Create( "gmod__hands" );
		// print( _hands )
		if ( IsValid( _hands ) ) then
			_p:SetHands( _hands );
			_hands:SetOwner( _p );

			-- //Which _hands should we use?
			local _model = _p:GetInfo( "_model" );
			local _data = player_manager.TranslatePlayerHands( _model );
			if ( _data ) then
				_hands:SetModel( _data.model );
				_hands:SetSkin( _data.skin );
				_hands:SetBodyGroups( _data.body );
			end

			// Attach them to the viewmodel
			local _vm = _p:GetViewModel( 0 );
			_hands:AttachToViewmodel( _vm );

			_vm:DeleteOnRemove( _hands );
			_p:DeleteOnRemove( _hands );

			_hands:Spawn( );
		end
		// End VM Hands system..
	end );
else
	hook.Add( "PostDrawViewModel", "PostDrawViewModel:NewHands", function( __vm, _p, _w )
		if ( _w.UseHands || !_w:IsScripted( ) ) then
			local _hands = _p:GetHands( );
			if ( IsValid( _hands ) ) then _hands:DrawModel( ); end
		end
	end );
end

Remember, this was the OLD method so…