SWEP: ViewModelBoneMods not working?

I was messing around with SWEP Construction Kit and thought of a funny gun idea: a “finger” gun. Y’know, when you hold your fingers up in the shape of a gun.

I got this from the the “print to console” button:


SWEP.HoldType = "pistol"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/cstrike/c_pist_fiveseven.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true
SWEP.ViewModelBoneMods = {
	["v_weapon.FIVESEVEN_PARENT"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }
}
*********************************************
Code printed to console!


This is what that looks like in SWEP Construction Kit:

https://s11.postimg.org/7o11k4h3n/fiveseven_parent.png

Looks “invisible” because the scale is set so low. That’s perfect!

However, it doesn’t work when I paste it into a modified version of weapon_zm_pistol’s SWEP:



AddCSLuaFile()

SWEP.HoldType = "pistol"


if CLIENT then
   SWEP.PrintName = "Finger Gun"
   SWEP.Slot = 1

   SWEP.Icon = "vgui/ttt/icon_pistol"
   SWEP.IconLetter = "u"
end

SWEP.Kind = WEAPON_PISTOL
SWEP.WeaponID = nil

SWEP.Base = "weapon_tttbase"
SWEP.Primary.Recoil	= 1.5
SWEP.Primary.Damage = 35
SWEP.Primary.Delay = 0.45
SWEP.Primary.Cone = 0.02
SWEP.Primary.ClipSize = -1
SWEP.Primary.Automatic = false
SWEP.Primary.DefaultClip = -1
SWEP.Primary.ClipMax = -1
SWEP.Primary.Ammo = nil
SWEP.AutoSpawnable = false
SWEP.AmmoEnt = nil

SWEP.UseHands			= true
SWEP.ViewModelFlip		= false
SWEP.ViewModelFOV		= 54
SWEP.ViewModel  = "models/weapons/cstrike/c_pist_fiveseven.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true
SWEP.ViewModelBoneMods = {
	["v_weapon.FIVESEVEN_PARENT"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }
}

SWEP.Primary.Sound = Sound( "bot/foyer.wav" )

function SWEP:CanPrimaryAttack()
	return true
end

SWEP.IronSightsPos = Vector(-5.801, 0, 4.8)
SWEP.IronSightsAng = Vector(0, 0, 0)

The fiveseven viewmodel looks perfectly normal (thus no screenshot needed). The iron sights made with SWEP Construction Kit work, though. Am I missing something? What’s wrong with the SWEP?

If I’m not wrong you have to copy the base code from SWEP Construction Kit.
You can find it in the SWEP Construction Kit or you can just copy it here https://github.com/Clavus/SWEP_Construction_Kit/blob/master/lua/weapons/swep_construction_kit/base_code.lua

But I’m not sure :p.

I had this problem when making one of my addons, cant remember how I fixed it tho.

markusmarkusz is correct, you have to modify the base code in accordance with your own scripts in order for it to work. Luckily it’s simple for the most part, just paste the base code in and adjust the corresponding functions to the ones that already exist. I know I’m kind of late but here I am!