Here is the script with just one animation, now i need to have another one and have the first one played the first time the function is triggered, the second one second time, then first one again etc...
wait() local ev = script.Parent ev.OnServerEvent:Connect(function(player) local dmg = game.ReplicatedStorage.Dmg:Clone() local anim = player.Character.Humanoid:LoadAnimation(dmg.anim) anim:Play() wait(.2) dmg.Parent = player.Character.RightHand local weld = Instance.new("Weld") weld.Parent = dmg weld.Part0 = player.Character.RightHand weld.Part1 = player.Character.RightHand.Dmg weld.C1 = CFrame.new(0,3,0) wait(.2) dmg:Destroy() end)
For that you need to use debounce and here is an example script
local ev = script.Parent local debounce = false local Track = nil ev.OnServerEvent:Connect(function(player) local dmg = game.ReplicatedStorage:WaitForChild("dmg"):Clone() local Anim1 = dmg.Anim1 local Anim2 = dmg.Anim2 local char = player.Character or player.CharacterAdded:Wait() if debounce == false then debounce = true Track = char.Humanoid:LoadAnimation(Anim1) Track:Play() dmg.Parent = char.RightHand local weld = Instance.new("Weld") weld.Parent = dmg weld.Part0 = dmg weld.Part1 = char.RightHand weld.C1 = CFrame.new(0,3,0) wait(.2) dmg:Destroy() else debounce = false Track = char.Humanoid:LoadAnimation(Anim2) Track:Play() dmg.Parent = char.LeftHand local weld = Instance.new("Weld") weld.Parent = dmg weld.Part0 = dmg weld.Part1 = char.LeftHand weld.C1 = CFrame.new(0,3,0) wait(.2) dmg:Destroy() end end)