#gun equip animation w custom viewmodel

6 messages · Page 1 of 1 (latest)

clever quarry
#

i made my own viewmodel n animations n whenever i equip a weapon the animation is delayed

this is the code i have for it

if Modules.Game:FindFirstChild(Item) then
        
  Framework.Module = require(Modules.Game:FindFirstChild(Item))
        
  if Rigs:FindFirstChild(Item) then
            
      Framework.Viewmodel = Rigs:FindFirstChild(Item):Clone()
            
      Framework.Viewmodel.Parent = Camera
            
      pcall(function()
   Framework.Viewmodel:FindFirstChild("AnimationController").Animator:LoadAnimation(Framework.Viewmodel:FindFirstChild("Equip_Animation")):Play()
      end)
            
      local Crosshair = Framework.Viewmodel:FindFirstChild("crosshair")
            
      if Crosshair then
          Crosshair.Parent = Player.PlayerGui
      end
            
      LoadSlot_Event:FireServer(Framework.Module.Fire_Sound, Framework.Viewmodel.Name)
            
      local Equip_Sound = Framework.Viewmodel:FindFirstChild("Equip")
      if Equip_Sound then
          Equip_Sound:Play()
      end
            
   end
        
end
fluid dune
#

looks like you're loading the animation into the Animator every time it happens and playing that in the same line. Or am I wrong?
Have you tried something like

Animator = Framework.Viewmodel:FindFirstChild("AnimationController").Animator
if not haveAnim then
  anim = instance.new("animation")
  anim.animationid = "rbxassetid://a"
  animTrack = Animator:LoadAnimation(anim)

  -- play anim

else
  -- play anim
end``` when i do something like this i get no anim lag, u should only have to create it once, u can remove the animation if u dont need it anymore i wouldnt create and load all in 1 line every time
clever quarry
#

ill try out doing it ur way n see if it fixes it

fluid dune
#

only saying that my way doesn't have that delay so may as well try it

clever quarry
#

nope doesnt work