Hello!
I have created a weapon system that when a tool is equipped, should play an animation, and when unequipped, stop. I also have put a priority and weight parameter there, so that the Equip animation plays “Idle” and 0.5 weight. However, it does not seem to affect the default roblox animation, and stops any other movement from occurring.
Here is my code for animating:
function weapon:animate(id, priority, weight)
local animator = self.givenPlayer.Character:WaitForChild("Humanoid").Animator
if not animator then
error("Animator was not found in " .. self.givenPlayer.Name .. "'s humanoid.")
else
local animation = Instance.new("Animation")
animation.AnimationId = id
local loadedAnim = animator:LoadAnimation(animation)
loadedAnim.Priority = priority
loadedAnim:AdjustWeight(weight)
loadedAnim:Play()
self.currentAnim = loadedAnim
end
end
function weapon:onEquip()
print(self.title .. " has been equipped!")
self:animate(self.animations["equip"], Enum.AnimationPriority.Idle, 0.5)
end
How can i let the walk animation play but also let the equip fully finish and hold the arms position?