Tool gun view model appears to be world model

I’m having a strange issue right now where the view model of the tool gun will appear to be the world model. The only thing that’s missing is the hand holding it. I’ve written a small script in an attempt to debug this issue:

local function WhatsMyVM( ply, cmd, args )
local ent = ply:GetViewModel()
if IsValid( ent ) then
local mdl = ent:GetModel()
print( "Current view model: "…mdl )

local wep = ply:GetActiveWeapon()
if IsValid( wep ) then
	print( "You are currently holding "..wep:GetClass() )
	print( "Wep's model is: "..wep:GetModel() )
	print( "The weapons table is as follows:" )
	PrintTable( wep:GetTable() )

concommand.Add( “ldrp_dbgvm”, WhatsMyVM, nil, “Prints the view model and other information of the currently held weapon.” )

Which outputs the following (minus the table):

As I understand it, c_toolgun is supposed to be a proper view model. However, for what ever reason, my game mode is still drawing it as the world model. I don’t have gmod_tool defined in my game mode’s entities/weapons folder, nor can I think of anything that would override the view model (without somehow changing what GetViewModel() receives).

I know this is really shooting in the dark, but can anyone think of any code that might be changing the tool gun’s view model in a such a way that the game doesn’t seem to perceive it as being changed?

Is this when you are using the built in toolgun, or a weapon with the toolgun model?
If it’s a weapon, you could try adding SWEP.UseHands = true
If it’s the built in toolgun, sorry but I don’t know what would cause that.

You said that the hand holding it is missing. I think you can only have the hands if you either declare the player class or reroute the functions.

What do you mean by declare the player class or reroute the functions?

Hopefully I’m not reading what you posted wrong.

In [base/gamemode/player_class/player_default]:

function PLAYER:Spawn()

    local oldhands = self.Player:GetHands();
    if ( IsValid( oldhands ) ) then

    local hands = ents.Create( "gmod_hands" )
    if ( IsValid( hands ) ) then
        hands:DoSetup( self.Player )


If you set the player class to that (player_manager.SetPlayerClass( ply, “player_default” )) and you make sure to run the Spawn function, the hands spawn. Thats what the hands really are in the c_ viewmodels: Its an entity.

What I mean by rerouting the functions is if you don’t want to use the classes, you just have to take that stuff and just put it in the gamemode spawn or whatever.

And yeah, make sure you do this if it is a weapon:

Shoot, I had no idea the hands were actually an entity. You were right Icebomb, in fact, there were several things wrong with what I was doing. For one, I wasn’t calling the base class of PlayerSpawn (so like you said, I was actually re-routing a few important functions). Besides that, I was not setting the player class. Now that I have that all fixed up, the hands are back. This whole player class thing looks really interesting!

Thanks for helping me out, guys.