Can someone help me with my touched event

So i want to make this part damage people and fling them upwards as well ragdoll them

however the issue is that the part isnt working and everytime it touches someone, it says “Head is not a valid member of workspace” even though i make sure to check there is a humanoid in the part that touched it


local Debris = game:GetService("Debris")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local RagdollModule = require(game.ReplicatedStorage.GameModules.Ragdoll)

function CreateAssumption(Slot)
	return Slot/1.25*1.2
end

function CreateDamage(Slot1, Slot2)
	return math.abs(Slot1) - math.exp(Slot1/Slot2) * math.fmod(Slot1 * 2, Slot1 * 1)+Slot2-Slot1+math.sqrt(2)
end

function SendNotifcation(Player, Title, Text)
	local Remote = game.ReplicatedStorage.Remotes.Main.Options

	Remote:FireClient(Player, "1", Text, Title, 2.5)
end

function Tag(Humanoid, Value)
	local NewVal = Instance.new("ObjectValue", Humanoid)
	NewVal.Name = "ContributionVar"
	NewVal.Value = Value
	spawn(function()
		Debris:AddItem(NewVal, 0.005)
	end)
end

function CreateAnimation(Id)
	local Animation = Instance.new("Animation")

	Animation.AnimationId = Id
	return Animation
end

function DamageStun(Enemy, Speed)
	local Chance = math.random(1, 2)

	if Chance == 1 then
		local Var1 = Enemy:WaitForChild("Stunned")
		local Stun = CreateAnimation("rbxassetid://6968675310")
		local Humanoid = Enemy:WaitForChild("Humanoid")
		local Stunner = Humanoid:LoadAnimation(Stun)

		Var1.Value = true
		Stunner:Play(1, 1, Speed)

		Stunner.Stopped:connect(function()
			Var1.Value = false
		end)
	elseif Chance == 2 then
		local Var1 = Enemy:WaitForChild("Stunned")
		local Stun = CreateAnimation("rbxassetid://6968675310")
		local Humanoid = Enemy:WaitForChild("Humanoid")
		local Stunner = Humanoid:LoadAnimation(Stun)

		Var1.Value = true
		Stunner:Play(1, 1, Speed or 1)

		Stunner.Stopped:connect(function()
			Var1.Value = false
		end)
	end
end

function Indicate(Damage, Color, Adornee)
	local GUI = game.ReplicatedStorage.GameModules.Damage.DamageIndicator:Clone()
	GUI.Parent = workspace
	GUI.Adornee = Adornee

	local Text = GUI:WaitForChild("TextLabel")
	Text.Text = Damage
	Text.TextColor3 = Color

	local Goals = {}
	Goals.TextTransparency = 1
	Goals.TextSize = 45
	Goals.TextStrokeTransparency = 1

	local Info = TweenInfo.new(
		.5
	)

	local Tween = TweenService:Create(Text, Info, Goals)

	Tween:Play()

	Tween.Completed:connect(function()
		GUI:Destroy()
	end)
end

local Sender = script.Parent.Parent.Parent
local RagDoll = require(game.ReplicatedStorage.GameModules.Ragdoll)

local Remote = game.ReplicatedStorage.Remotes.Main.Options
local Debounce = false

script.Parent.Touched:Connect(function(Hit)
	if Debounce == true then return end
	if Debounce == false then
		Debounce = true
		spawn(function()
			wait(1.25)
			Debounce = false
		end)
		
		local HumanoidCheck = Hit.Parent:FindFirstChild("Humanoid")
		print(HumanoidCheck.Parent.Name)
		if HumanoidCheck and Hit.Parent ~= Sender then

			local Damage = 45

			local AssumedDamage = CreateAssumption(Damage)
			local ChangedDamage = CreateDamage(Damage, AssumedDamage)

			local EnemyCharacter = HumanoidCheck.Parent or Hit.Parent
			local EnemyHumanoid = EnemyCharacter:WaitForChild("Humanoid")
			local EnemyHead = EnemyCharacter.Head
			local EnemyTorso = EnemyCharacter.Torso
			local EnemyHRP = EnemyCharacter.HumanoidRootPart
			local EnemyLArm = EnemyCharacter["Left Arm"]
			local EnemyRArm = EnemyCharacter["Right Arm"]
			local EnemyLLeg = EnemyCharacter["Left Leg"]
			local EnemyRLeg = EnemyCharacter["Right Leg"]

			local Blocking = EnemyCharacter:WaitForChild("Blocking")
			local Parrying = EnemyCharacter:WaitForChild("Parrying")

			local WeakState = EnemyCharacter:WaitForChild("WeakMulti").Value
			local Defense = EnemyCharacter:WaitForChild("Defense").Value
			local BlockMulti = EnemyCharacter:WaitForChild("BlockMulti").Value

			local SenderPower = Sender:WaitForChild("Power").Value
			local SenderWeakState = Sender:WaitForChild("WeakMulti").Value

			local SenderHumanoid = Sender:WaitForChild("Humanoid")
			local SenderHealth = SenderHumanoid.Health
			local SenderMaxHealth = SenderHumanoid.MaxHealth

			if Parrying == false and EnemyHumanoid.Health > 0 and Blocking == false then
				local TrueDamage = ChangedDamage * SenderPower / SenderWeakState * WeakState / Defense
				EnemyHumanoid:TakeDamage(TrueDamage)
				Indicate(TrueDamage, Color3.fromRGB(175, 0, 3), EnemyTorso)
				Tag(EnemyHumanoid, Sender)
				spawn(function()
					Remote:FireClient(game.Players:GetPlayerByCharacter(EnemyCharacter), "4", Sender.Name, TrueDamage, EnemyCharacter.Name)
				end)

				if EnemyHumanoid.Health <= 0 then
					if EnemyHumanoid:FindFirstChild("ContributionVar") then
						local FoundTag = EnemyHumanoid:FindFirstChild("ContributionVar") 
						if FoundTag.Value == Sender then
							SendNotifcation(game.Players:GetPlayerFromCharacter(Sender), "You killed ".. EnemyCharacter.Name, "Great Job!")
							Indicate("+".. SenderMaxHealth - SenderHealth, Color3.new(0.145586, 0.631785, 0.0565652), Sender:WaitForChild("Torso"))
							SenderHealth = SenderMaxHealth
						elseif FoundTag.Value ~= Sender then
							return
						end
					elseif not EnemyHumanoid:FindFirstChild("ContributionVar") then
						return
					end
				end

				spawn(function()
					RagDoll:ragdoll(EnemyCharacter, 1.75)
				end)

				spawn(function()
					local Up = Instance.new("BodyVelocity", EnemyCharacter)
					Up.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
					Up.P = 72500
					Up.Velocity = Vector3.new(0, 4.5, 0)
					spawn(function()
						wait(1.75)
						Up:Destroy()
					end)
				end)

			elseif Parrying == false and EnemyHumanoid.Health > 0 and Blocking == true then
				local TrueDamage = ChangedDamage * SenderPower / SenderWeakState * WeakState / Defense / BlockMulti
				EnemyHumanoid:TakeDamage(TrueDamage)
				Indicate("BLOCK BREAKER!", Color3.fromRGB(15, 72, 177), EnemyTorso)
				Indicate(TrueDamage, Color3.fromRGB(15, 72, 177), EnemyTorso)
				Tag(EnemyHumanoid, Sender)
				spawn(function()
					Remote:FireClient(game.Players:GetPlayerByCharacter(EnemyCharacter), "4", Sender.Name, TrueDamage, EnemyCharacter.Name)
				end)

				if EnemyHumanoid.Health <= 0 then
					if EnemyHumanoid:FindFirstChild("ContributionVar") then
						local FoundTag = EnemyHumanoid:FindFirstChild("ContributionVar") 
						if FoundTag.Value == Sender then
							SendNotifcation(game.Players:GetPlayerFromCharacter(Sender), "You killed ".. EnemyCharacter.Name, "Great Job!")
							Indicate("+".. SenderMaxHealth - SenderHealth, Color3.new(0.145586, 0.631785, 0.0565652), Sender:WaitForChild("Torso"))
							SenderHealth = SenderMaxHealth
						elseif FoundTag.Value ~= Sender then
							return
						end
					elseif not EnemyHumanoid:FindFirstChild("ContributionVar") then
						return
					end
				end

				spawn(function()
					RagDoll:ragdoll(EnemyCharacter, 1.75)
				end)

				spawn(function()
					local Up = Instance.new("BodyVelocity", EnemyCharacter)
					Up.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
					Up.P = 72500
					Up.Velocity = Vector3.new(0, 4.5, 0)
					spawn(function()
						wait(1.75)
						Up:Destroy()
					end)
				end)
			elseif Parrying == true and EnemyHumanoid.Health > 0 then
				local TrueDamage = 0
				EnemyHumanoid:TakeDamage(TrueDamage)
				Indicate("MISS", Color3.fromRGB(171, 169, 177), EnemyTorso)
				Tag(EnemyHumanoid, Sender)
				spawn(function()
					Remote:FireClient(game.Players:GetPlayerByCharacter(EnemyCharacter), "5", Sender.Name, EnemyCharacter.Name)
				end)
			end
		end
	end 	
end)

Head should be in the character and not the workspace, unless there is another object in the workspace named head.

I tried doing a check to see if the part’s parent is a character but it still didnt work