How do make sword swing animations play different animation every time

nope, it still isnt working. Should I add this in other script or in the main script, like can you edit my script?

You add it in the main script for where you make your animationsā€¦ I think it is kinda obvious where to put it

You used anim1 3 times so he must do anim1, anim2 and anim3

Here

local swing = 1

local anim1 = swing1 -- anim
local anim2 = swing2 -- anim
local anim3 = swing3 -- anim

if swing == 1 then
	swing = 2
	
	humanoid.Animator:LoadAnimation(anim1):Play()
	
elseif swing == 2 then
	swing = 3

	humanoid.Animator:LoadAnimation(anim2):Play()
elseif swing == 3 then
	swing = 1

	humanoid.Animator:LoadAnimation(anim3):Play()
end

It can be used like this too, itā€™s the same but if you will add more so there

local swing = 1

local anim1 = swing1 -- anim
local anim2 = swing2 -- anim
local anim3 = swing3 -- anim

if swing == 1 then
	swing += 1
	
	humanoid.Animator:LoadAnimation(anim1):Play()
	
elseif swing == 2 then
	swing += 1

	humanoid.Animator:LoadAnimation(anim2):Play()
elseif swing == 3 then
	swing = 1

	humanoid.Animator:LoadAnimation(anim3):Play()
end

Cant something happen if you do this? What if they lag or something, then the swing variable goes above 3? You will have to use

elseif swing >= 3 then

That will never happen unless your device are very totally truly good ( bad )

for a basic combo anim i would just make 3/4 localscripts in the script i would just put the userinputservice, find the plrs humanoid, add debounce, detect the anims, the equipped detection, the key being clicked, a remote event, when clicked it disables the current script and enables the other script like this example:
this is clientsided

local Debounce = false
local remote = script.parent.remote1
local us = Game:Getservice("UserInputService")
local plr = game.Players.localplayer
	UserInputService.InputBegan:Connect(function(input)
		local inputType = input.UserInputType
		if inputType == Enum.UserInputType.MouseButton1 then
                 if Debounce == false then
                   Debounce = true
                  local attack1 = plr.Character.Humanoid:LoadAnimation(script.Parent.Anims.Attack1)
                   remote:FireServer()
                   attack1:Play()
                 wait(0.4) -- how long the anim takes and what you want after
                local Debounce = false
                script.parent:FindFirstChild("Attack2").Enabled = true
                script.parent.enabled = true
			end
		end
	end)    
end)
                    

This is Serversided

local remote = script.parent.remote1
remote.OnServerEvent:Connect(function)
local Attack = script.parent.parent:FindFirstChild("Humanoid").LoadAnimation(script.Parent.Parent.Anims.Attack1) 
Attack:Play()
end)

!!!YOU COULD USE RAYCASTV4 FOR DMG!!!
if raycastv4 is used do this in the serversided script

local RaycastHitbox = require(game.ServerScriptService.RaycastHitboxV4)

you need to create attachments on the tool where you want dmg and locate them with this for example:

local Hitbox = RaycastHitbox.new(script.parent.handle.attachments)

then make the hitstart

Hitbox:HitStart()

then detect if a humanoid is hit by doing this:

	Hitbox.OnHit:Connect(function(hit, humanoid)

then make it do dmg by doing this:

humanoid:TakeDamage(5)

hope this helped!

I am sorry, but client scripts arent needed in a weapon, ESPECIALLY FOUR OF THEM. If you arent making the weapon swing while holding down, then client scripts are irrelevant, because the server can just use:

Tool.Activated

FYI: you have to add Hitbox:HitStop() when using the module.

o ye forgot about the hit stop but i am also trying to make the anims look good on the client so when you lag you can still swing!

The problem with this is exploiters can just change the client sided script to make the HitStop() never fireā€¦ so basicalyl the hitbox will be active as always so they dont have to wait for cooldowns and stuff