I cleaned the code some but try using the animator that way it replicates the animations to all clients
the way your doing the attack animations is abit odd but should work i think
you may want to set these animations priorities to action
wait(1)
local tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character
local hum = Character:WaitForChild("Humanoid")
local Animator = hum:WaitForChild('Animator')
local animload = Animator:LoadAnimation(tool.Anim:WaitForChild("DuelGunWeld"))
local animloadidle = Animator:LoadAnimation(tool.Anim:WaitForChild("DuelGunIdle"))
local count = 0
local attackanim = {
tool.Anim.Attack[1],
tool.Anim.Attack[2],
}
tool.Equipped:Connect(function()
local char = Player.Character
local hum = char:FindFirstChild("Humanoid")
spawn(function()
animload:Play()
animload.Stopped:Wait()
animloadidle:Play()
end)
end)
tool.Unequipped:Connect(function()
spawn(function()
animload:Stop()
animloadidle:Stop()
end)
end)
tool.Activated:Connect(function()
count += 1
print(count)
local attackanim = Animator:LoadAnimation(attackanim[count])
attackanim:Play()
if count >= 2 then
count = 0
end
end)