Sword Animations isn't working

Hello! Im trying to make it so that the animations play each slash, but it doesnt work, heres the error

  13:10:05.494   ▶ Workspace.NubblyFry.The Underdog.LocalScript:18: Expected 'end' (to close 'else' at line 16), got 'else' (x3)  -  Studio - LocalScript:18
  13:10:25.122  Image https://assetdelivery.roblox.com/v1/asset?id=6933968235 failed to load. Error 403: Asset type does not match requested type  -  Studio
local plr = game.Players.LocalPlayer
local Slash1 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash1"))
local Slash2 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash2"))
local Slash3 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash3"))
local num = 1
script.Parent.Equipped:Connect(function()
	Slash1:Play()
end)
script.Parent.Equipped:Connect(function()
	Slash1:Stop()
end)
script.Parent.Activated:Connect(function()
	if num == 1 then
		Slash1:Play()
		script.Parent.RemoteEvent:FireServer()
	else
		Slash2:Play()
		else
	Slash3:Play()
	   end
	end
end)

Firstly I would like to say that the Equipped connection basically cancel each other out right? Also you have an if statement with 2 else’s back to back so what you should have is:

if then

elseif then

else

end

That’s the order it should be in this case it wouldn’t work. So I would recommend looking through the default sword roblox provides in tool box and reading through that since that’s what it looks like you need.

As for the error to be specific you have a random else and end. Removing it will fix the error but I believe the sword animation would be weird or not function at all.

1 Like

didn’t work

local plr = game.Players.LocalPlayer
local Slash1 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash1"))
local Slash2 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash2"))
local Slash3 = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Slash3"))
local num = 1
script.Parent.Equipped:Connect(function()
	Slash1:Play()
end)
script.Parent.Equipped:Connect(function()
	Slash1:Stop()
end)
script.Parent.Activated:Connect(function()
	if num == 1 then
		Slash1:Play()
		script.Parent.RemoteEvent:FireServer()
	elseif
		Slash2:Play() then
	else
		Slash3:Play()
	end
end)

No error came in the output.