Equip animation is extremely glitchy
Equipping animation works fine (it doesn’t look great) the first time i equip the knife, but the more I do it it’s like it reduces the animations duration or something
I am making a fps framework (my first attempt atleast) and I am trying to figure out animations, I am currently working on the melee or knife because it’s the easiest to animate.
Video and code blocks below
-- melee
UIS.InputBegan:Connect(function(input, _)
if input.KeyCode == Enum.KeyCode.Three then
if currentViewmodel == secondary or currentViewmodel == primary then
secondary.Parent = viewmodelDirectory
primary.Parent = viewmodelDirectory
melee.Parent = camera
currentViewmodel = melee
print("swapping to melee")
sounds.equip:Play()
else
melee.Parent = camera
currentViewmodel = melee
print("swapping to melee")
sounds.equip:Play()
end
-- animation stuff
local currentViewmodelAnimations = currentViewmodel:WaitForChild("AnimationController")
-- equip
local meleeEquip = currentViewmodelAnimations:WaitForChild("Equip")
local equipTrack = currentViewmodelAnimations:LoadAnimation(meleeEquip)
-- idle
local meleeIdle = currentViewmodelAnimations:WaitForChild("Idle")
local idleTrack = currentViewmodelAnimations:LoadAnimation(meleeIdle)
equipTrack:Play()
equipTrack.Ended:Connect(function()
idleTrack:Play()
print("equipping anim done")
end)
end
end)
any help is appreciated