local function b() end Tool.Equipped:Connect(function()Equipped=true Char=Tool.Parent HumRP=Char:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")Humanoid=Char:WaitForChild("\072\117\109\097\110\111\105\100")Animations={Z=Humanoid:LoadAnimation(script.Animations.Z);X=Humanoid:LoadAnimation(script.Animations.X)}if not loopConnection then loopConnection=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Connect(function()if UIS:IsKeyDown(Enum.KeyCode.Z)then if Char:FindFirstChild("\068\105\115\097\098\108\101\100")then return end if not Z then if Equipped and(not CS:HasTag(Char,"\090")and not CS:HasTag(Char,"\066\117\115\121"))then SkillsHandler:FireServer("\083\107\105\108\108",Tool.Name,"\072\111\108\100","\090")end end Z=true else if Z then isHolding=false SkillsHandler:FireServer("\083\107\105\108\108",Tool.Name,"\082\101\108\101\097\115\101","\090",(Mouse:GetHit()).Position,Char.HumanoidRootPart.CFrame)Animations.Z:AdjustSpeed(1)end Z=false end if UIS:IsKeyDown(Enum.KeyCode.X)then if Char:FindFirstChild("\068\105\115\097\098\108\101\100")then return end if not X then if Equipped and(not CS:HasTag(Char,"\088")and not CS:HasTag(Char,"\066\117\115\121"))then SkillsHandler:FireServer("\083\107\105\108\108",Tool.Name,"\072\111\108\100","\088")end end X=true else if X then isHolding=false SkillsHandler:FireServer("\083\107\105\108\108",Tool.Name,"\082\101\108\101\097\115\101","\088",(Mouse:GetHit()).Position)Animations.X:AdjustSpeed(1)end X=false end end)end if not holdingConnection then holdingConnection=Holding.Changed:Connect(function()(coroutine.wrap(function()if Holding.Value~="\078\111\110\101"then HumRP.Anchored=true isHolding=true if Holding.Value=="\090"then Animations.Z:Play();(Animations.Z:GetMarkerReachedSignal("\073\100\108\101")):Connect(function()if isHolding==true then Animations.Z:AdjustSpeed(0)end end)repeat HumRP.CFrame=CFrame.lookAt(HumRP.Position,(Mouse:GetHit()).Position)task.wait()until Holding.Value~="\090"elseif Holding.Value=="\088"then Animations.X:Play();(Animations.X:GetMarkerReachedSignal("\073\100\108\101")):Connect(function()if isHolding==true then Animations.X:AdjustSpeed(0)end end)repeat HumRP.CFrame=CFrame.lookAt(HumRP.Position,Vector3.new((Mouse:GetHit()).Position.X,HumRP.Position.Y,(Mouse:GetHit()).Position.Z))task.wait()until Holding.Value~="\088"end else HumRP.Anchored=false end end))()end)end end)Tool.Unequipped:Connect(function()Equipped=false if loopConnection~=nil then loopConnection:Disconnect()loopConnection=nil end if holdingConnection~=nil then holdingConnection:Disconnect()holdingConnection=nil end end)

local function checkHolding()

end

Tool.Equipped:Connect(function()
	Equipped = true

	Char = Tool.Parent
	HumRP = Char:WaitForChild("HumanoidRootPart")
	Humanoid = Char:WaitForChild("Humanoid")

	Animations = {
		["Z"] = Humanoid:LoadAnimation(script.Animations.Z),
		["X"] = Humanoid:LoadAnimation(script.Animations.X),
	}

	if not loopConnection then
		loopConnection = game:GetService("RunService").RenderStepped:Connect(function()
			if UIS:IsKeyDown(Enum.KeyCode.Z) then
				if Char:FindFirstChild("Disabled") then return end
				if not Z then
					if Equipped and not CS:HasTag(Char, "Z") and not CS:HasTag(Char, "Busy") then
						SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "Z")
					end
				end
				Z = true
			else
				if Z then
					isHolding = false
					SkillsHandler:FireServer("Skill", Tool.Name, "Release", "Z", Mouse:GetHit().Position, Char.HumanoidRootPart.CFrame)
					Animations.Z:AdjustSpeed(1)
				end
				Z = false
			end
			
			if UIS:IsKeyDown(Enum.KeyCode.X) then
				if Char:FindFirstChild("Disabled") then return end
				if not X then
					if Equipped and not CS:HasTag(Char, "X") and not CS:HasTag(Char, "Busy") then
						SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "X")
					end
				end
				X = true
			else
				if X then
					isHolding = false
					SkillsHandler:FireServer("Skill", Tool.Name, "Release", "X", Mouse:GetHit().Position)
					Animations.X:AdjustSpeed(1)
				end
				X = false
			end
		end)
	end
	
	if not holdingConnection then
		holdingConnection = Holding.Changed:Connect(function()
			coroutine.wrap(function()
				if Holding.Value ~= "None" then
					HumRP.Anchored = true
					isHolding = true
					if Holding.Value == "Z" then
						Animations.Z:Play()
						Animations.Z:GetMarkerReachedSignal("Idle"):Connect(function()
							if isHolding == true then
								Animations.Z:AdjustSpeed(0)
							end
						end)

						repeat
							HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse:GetHit().Position)
							task.wait()
						until Holding.Value ~= "Z"
					elseif Holding.Value == "X" then
						Animations.X:Play()
						Animations.X:GetMarkerReachedSignal("Idle"):Connect(function()
							if isHolding == true then
								Animations.X:AdjustSpeed(0)
							end
						end)

						repeat
							HumRP.CFrame = CFrame.lookAt(HumRP.Position, Vector3.new(Mouse:GetHit().Position.X, HumRP.Position.Y, Mouse:GetHit().Position.Z))
							task.wait()
						until Holding.Value ~= "X"
					end
				else
					HumRP.Anchored = false
				end
			end)()
		end)
	end
end)

Tool.Unequipped:Connect(function()
	Equipped = false

	if loopConnection ~= nil then
		loopConnection:Disconnect()
		loopConnection = nil
	end
	
	if holdingConnection ~= nil then
		holdingConnection:Disconnect()
		holdingConnection = nil
	end
end)
