function checkTeams(X)return not(sameTeam(X)and not FriendlyFire)end function onHandleTouched(X)if not AttackDamaging then return end if X:IsDescendantOf(Tool.Parent)then return end if X.Parent and X.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then local G=X.Parent.Humanoid if checkTeams(G)and not contains(AttackVictims,G)then tagHuman(G)table.insert(AttackVictims,G)G:TakeDamage(AttackDamage)end end end function onProjectileTouched(X)if X:IsDescendantOf(Tool.Parent)then return end if X.Parent and X.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then local G=X.Parent.Humanoid if checkTeams(G)and not contains(AttackProjectileVictims,G)then tagHuman(G)table.insert(AttackProjectileVictims,G)G:TakeDamage(AttackDamage)end end end function onLeftHold()Remote:FireClient(getPlayer(),"\080\108\097\121\065\110\105\109\097\116\105\111\110","\083\119\105\110\103\050")delay(.1,function()Handle.Swing.Pitch=.8 Handle.Swing:Play()delay(.4,function()Handle.Swing.Pitch=1 Handle.Swing:Play()delay(.3,function()Handle.Swing.Pitch=1.2 Handle.Swing:Play()Handle.Shot.Pitch=math.random(90,110)/100 Handle.Shot:Play()end)end)end)wait(.8)local X=Tool.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if X then local G=Instance.new("\080\097\114\116")G.CanCollide=false G.FormFactor="\067\117\115\116\111\109"G.TopSurface="\083\109\111\111\116\104"G.BottomSurface="\083\109\111\111\116\104"G.BrickColor=BrickColor.new("\076\105\109\101 \103\114\101\101\110")G.Size=Vector3.new(3,.2,3)G.CFrame=(X.CFrame*CFrame.new(0,0,-3))*CFrame.Angles(0,0,math.pi/2)Instance.new("\067\121\108\105\110\100\101\114\077\101\115\104",G)local E=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")E.maxForce=Vector3.new(1000000000.0,1000000000.0,1000000000.0)E.velocity=X.CFrame.lookVector*AttackProjectileSpeed E.Parent=G local m=Instance.new("\070\105\114\101")m.Color=G.BrickColor.Color m.SecondaryColor=m.Color m.Parent=G local C=Instance.new("\080\111\105\110\116\076\105\103\104\116")C.Range=16 C.Color=G.BrickColor.Color C.Parent=G G.Parent=workspace;(game:GetService("\068\101\098\114\105\115")):AddItem(G,5)AttackProjectileVictims={}local a=G.Touched:connect(onProjectileTouched)wait(.5)G.Anchored=true G.Transparency=1 a:disconnect()m.Enabled=false C:Destroy()end end function onLeftDown()if not AttackAble then return end AttackAble=false Remote:FireClient(getPlayer(),"\080\108\097\121\065\110\105\109\097\116\105\111\110","\083\119\105\110\103\049")delay(.2,function()Handle.Swing.Pitch=math.random(90,110)/100 Handle.Swing:Play()end)delay(AttackWindupTime,function()AttackVictims={}AttackDamaging=true delay(AttackWindow,function()AttackDamaging=false end)end)LeftDown=true local X=0 while LeftDown do X=X+Heartbeat:wait()if X>AttackHoldTime then onLeftHold()break end end delay(AttackRestTime,function()AttackAble=true end)end function onLeftUp()LeftDown=false end function onRemote(X,G,...)if X~=getPlayer()then return end if G=="\076\101\102\116\068\111\119\110"then onLeftDown(...)elseif G=="\076\101\102\116\085\112"then onLeftUp(...)end end Remote.OnServerEvent:connect(onRemote)Handle.Touched:connect(onHandleTouched)

function checkTeams(otherHuman)
	return not (sameTeam(otherHuman) and not FriendlyFire)
end

function onHandleTouched(part)
	if not AttackDamaging then return end
	if part:IsDescendantOf(Tool.Parent) then return end
	
	if part.Parent and part.Parent:FindFirstChild("Humanoid") then
		local human = part.Parent.Humanoid
		if checkTeams(human) and not contains(AttackVictims, human) then
			tagHuman(human)
			table.insert(AttackVictims, human)
			human:TakeDamage(AttackDamage)
		end
	end
end

function onProjectileTouched(part)
	if part:IsDescendantOf(Tool.Parent) then return end
	
	if part.Parent and part.Parent:FindFirstChild("Humanoid") then
		local human = part.Parent.Humanoid
		if checkTeams(human) and not contains(AttackProjectileVictims, human) then
			tagHuman(human)
			table.insert(AttackProjectileVictims, human)
			human:TakeDamage(AttackDamage)
		end
	end
end

function onLeftHold()
	Remote:FireClient(getPlayer(), "PlayAnimation", "Swing2")
	
	delay(0.1, function()
		Handle.Swing.Pitch = 0.8
		Handle.Swing:Play()
		delay(0.4, function()
			Handle.Swing.Pitch = 1
			Handle.Swing:Play()
			delay(0.3, function()
				Handle.Swing.Pitch = 1.2
				Handle.Swing:Play()
				Handle.Shot.Pitch = math.random(90, 110)/100
				Handle.Shot:Play()
			end)
		end)
	end)
	
	wait(0.8)
	
	local root = Tool.Parent:FindFirstChild("HumanoidRootPart")
	if root then
		local slash = Instance.new("Part")
		slash.CanCollide = false
		slash.FormFactor = "Custom"
		slash.TopSurface = "Smooth"
		slash.BottomSurface = "Smooth"
		slash.BrickColor = BrickColor.new("Lime green")
		slash.Size = Vector3.new(3, 0.2, 3)
		slash.CFrame = root.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(0, 0, math.pi/2)
		
		Instance.new("CylinderMesh", slash)
		
		local bv = Instance.new("BodyVelocity")
		bv.maxForce = Vector3.new(1e9, 1e9, 1e9)
		bv.velocity = root.CFrame.lookVector * AttackProjectileSpeed
		bv.Parent = slash
		
		local spark = Instance.new("Fire")
		spark.Color = slash.BrickColor.Color
		spark.SecondaryColor = spark.Color
		spark.Parent = slash
		
		local light = Instance.new("PointLight")
		light.Range = 16
		light.Color = slash.BrickColor.Color
		light.Parent = slash
		
		slash.Parent = workspace
		game:GetService("Debris"):AddItem(slash, 5)
		
		AttackProjectileVictims = {}
		local c = slash.Touched:connect(onProjectileTouched)
		
		wait(0.5)
		slash.Anchored = true
		slash.Transparency = 1
		c:disconnect()
		spark.Enabled = false
		light:Destroy()
	end 
end

function onLeftDown()
	if not AttackAble then return end
	AttackAble = false
	
	Remote:FireClient(getPlayer(), "PlayAnimation", "Swing1")
	
	delay(0.2, function()
		Handle.Swing.Pitch = math.random(90, 110)/100
		Handle.Swing:Play()
	end)
	
	delay(AttackWindupTime, function()
		AttackVictims = {}
		AttackDamaging = true
		delay(AttackWindow, function()
			AttackDamaging = false
		end)
	end)
	
	LeftDown = true
	local t = 0
	while LeftDown do
		t = t + Heartbeat:wait()
		if t > AttackHoldTime then
			onLeftHold()
			break
		end
	end
	
	delay(AttackRestTime, function()
		AttackAble = true
	end)
end

function onLeftUp()
	LeftDown = false
end

function onRemote(player, func, ...)
	if player ~= getPlayer() then return end
	
	if func == "LeftDown" then
		onLeftDown(...)
	elseif func == "LeftUp" then
		onLeftUp(...)
	end
end

Remote.OnServerEvent:connect(onRemote)
Handle.Touched:connect(onHandleTouched)
