No idea for a name (something about parry system)

Hello, so i got this script (a parry script) which detects if a part called a “Blade” hits a part named “ParryPart” then the player who hit the ParryPart gets their Humanoidrootpart anchored, tools unequipped, and their backpack disabled for 3 seconds.

local tool = script.Parent
local CanDamage = true
local CanBeParried = false
local soundTable = game.ReplicatedStorage.Sounds:GetChildren()
local sound = soundTable[math.random(1, #soundTable)]
tool.Equipped:Connect(function()
	tool.Activated:Connect(function()
		local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
		tool.Blade.Touched:Connect(function(Hit)
			if Hit.Name == "ParryPart" then
				CanBeParried = true
				if CanBeParried == true then
					local StarterGui = game:GetService("StarterGui")
					StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
					player.Character:FindFirstChild("HumanoidRootPart").Anchored = true
					player.Character:FindFirstChild("Torso"):FindFirstChild("ParrySound"):Play()
					player.Character:FindFirstChild("Humanoid"):UnequipTools()
					tool:FindFirstChild("ParryHandler").Enabled = false
					CanBeParried = false
					wait(3)
					CanBeParried = true
					local StarterGui = game:GetService("StarterGui")
					player.Character:FindFirstChild("HumanoidRootPart").Anchored = false
					StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
					tool:FindFirstChild("ParryHandler").Enabled = true
				end
			end
		end)
	end)
end)

but when i just click and then after a few seconds touch the ParryPart with my sword, i get anchored, but i want it to only happen when i touch it, please help.

1 Like