My tools show their animations, but weirdly. I usually preload the animations in the script and then play them and stop them, but I think that may be the issue with this problem. I have 2 tools and both have their own animations, when I try the tools the animations in the animator are most likely being played from the other tool.
I tried renaming the animations so they don’t have the same name when preloaded, but that didn’t work.
I would like to hear a better option to play these animations without them interfering.
Yes, both tools use the same script only changing in some parts, of course, also this script is a bit longer but I don’t want to share the whole script. This is simply just a cut-out part.
local equipAnimationPreload = player.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(animations:FindFirstChild("Equip"))
local idleAnimationPreload = player.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(animations:FindFirstChild("Idle"))
local holsterAnimationPreload = player.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(animations:FindFirstChild("Holster"))
local fireAnimationPreload = player.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(animations:FindFirstChild("Fire"))
-------------- - --------------
local replicatedStorage = game.ReplicatedStorage
local WeaponModule = require(replicatedStorage.WeaponSystem)
-------------- - --------------
tool.Equipped:Connect(function()
sounds.Equip:Play()
WeaponModule.onEquip()
equipAnimationPreload:Play()
player.PlayerGui:FindFirstChild("AmmoGui").MainFrame.AmmoLeft.Text = ammo
player.PlayerGui:FindFirstChild("AmmoGui").MainFrame.MaxAmmo.Text = maxAmmo
wait(equipAnimationPreload.Length)
idleAnimationPreload:Play()
end)
tool.Unequipped:Connect(function()
WeaponModule.onUnequip()
reloadAnimationPreload:Stop()
equipAnimationPreload:Stop()
idleAnimationPreload:Stop()
holsterAnimationPreload:Stop()
fireAnimationPreload:Stop()
end)````