Knockback and Stun Issues, neither of these work no matter where I move them, and most of my small tweaks have failed horribly

6th, or 7th post on this combat system.

I have tried multiple different methods to no avail. To achieve my goal, I simply want to do a stun system in which where I hit someone, they just stop, unable to jump.

	--Region3 In Action
		local HBFinder = workspace:FindPartsInRegion3(Re3, HitBox, 20)
		Debris:AddItem(HitBox, 0.3)
		for i, parts in pairs (HBFinder) do
			if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
				parts.Parent.Humanoid:TakeDamage(2.5)
				local m1STUNT = Instance.new("BoolValue")
				m1STUNT.Name = "eStun"
				m1STUNT.Parent = Character
				game.Debris:AddItem(m1STUNT,.7)

				if m1STUNT.Parent == parts then
					m1STUNT = true
					local NoMoving = Character.Humanoid.WalkSpeed == 0
					local NoJumping = false
					if NoJumping == true then return end
					if NoJumping == false then
					local bodyVelocity = Instance.new('BodyVelocity')
					bodyVelocity.Parent = Character.HumanoidRootPart
					bodyVelocity.MaxForce = Vector3.new(0, 0, 0)
					bodyVelocity.P = Vector3.new(0, 0, 0)
					Character.Humanoid.WalkSpeed = NoMoving
					
					print("Stun locked")
						m1STUNT = false
					end
				end
				break
			end-- If statement ended in forloop
		end--For loop ended

That’s it for the stun and absolutely nothing happens.

Be aware that the Count variable is in a different local script, I tried carrying the variable over, but it simply does nothing. Knockback is a whole different story as I tried the same method, and the Knockback still doesn’t work. I’m currently thinking if I should move it over to a local script but I’m not sure if I will have as much control. So, at the same time I have been thinking about bringing it to the ServerScript where the stun script doesn’t seem to work either.

wait(1)
--\\ Services //--

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")

--\\ Variables //--

local Debounce = false


script.Parent.OnServerEvent:Connect(function(Player, Action, Count)
	
	
	local Character = Player.Character
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	local HumanoidRootPart = Character.HumanoidRootPart
	local HM = Character:FindFirstChild("Humanoid")
	local Humanoid = Character.Humanoid
	local hb = workspace:FindFirstChild("Hitbox")
	
	if Action == ("Combat") and ("KB") then 
		Count = 1
		wait(0.3)
		Count = 2
		wait(0.3)
		Count = 3
		wait(0.2)
		Count = 4
		local PlayerOrientation = Player.Character.HumanoidRootPart.CFrame.LookVector --this will get the orientation that the player is looking at in the world space
		local VelocityModifier = 50 --the higher the number, the higher the velocity 
		local MaxForce = Vector3.new(50000,50000,50000) --higher numbers = more force applied to the player
		for i, parts in pairs(hb:GetChildren{}) do
			print("Hitbox does indeed exist begin to do dis")
			local bodyVelocity = Instance.new('BodyVelocity')
			bodyVelocity.Parent = parts.Parent.Humanoid
			bodyVelocity.MaxForce = MaxForce
			bodyVelocity.P = math.huge -- this makes the bodythrusts P value infinite
			bodyVelocity.Velocity = Vector3.new(-PlayerOrientation.X*VelocityModifier,-PlayerOrientation.Y*VelocityModifier,-PlayerOrientation.Z*VelocityModifier) --make sure to use the inverse of the players orientation, or the player will be knocked forward, rather than backwards
			bodyVelocity.Name = "Bang"
			game.Debris:AddItem(bodyVelocity,0.1) 
		end

	end
end)

The Full Scripts:

Knockback

wait(1)
--\\ Services //--

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")

--\\ Variables //--

local Debounce = false


script.Parent.OnServerEvent:Connect(function(Player, Action, Count)
	
	
	local Character = Player.Character
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	local HumanoidRootPart = Character.HumanoidRootPart
	local HM = Character:FindFirstChild("Humanoid")
	local Humanoid = Character.Humanoid
	local hb = workspace:FindFirstChild("Hitbox")
	
	if Action == ("Combat") and ("KB") then 
		Count = 1
		wait(0.3)
		Count = 2
		wait(0.3)
		Count = 3
		wait(0.2)
		Count = 4
		local PlayerOrientation = Player.Character.HumanoidRootPart.CFrame.LookVector --this will get the orientation that the player is looking at in the world space
		local VelocityModifier = 50 --the higher the number, the higher the velocity 
		local MaxForce = Vector3.new(50000,50000,50000) --higher numbers = more force applied to the player
		for i, parts in pairs(hb:GetChildren{}) do
			print("Hitbox does indeed exist begin to do dis")
			local bodyVelocity = Instance.new('BodyVelocity')
			bodyVelocity.Parent = parts.Parent.Humanoid
			bodyVelocity.MaxForce = MaxForce
			bodyVelocity.P = math.huge -- this makes the bodythrusts P value infinite
			bodyVelocity.Velocity = Vector3.new(-PlayerOrientation.X*VelocityModifier,-PlayerOrientation.Y*VelocityModifier,-PlayerOrientation.Z*VelocityModifier) --make sure to use the inverse of the players orientation, or the player will be knocked forward, rather than backwards
			bodyVelocity.Name = "Bang"
			game.Debris:AddItem(bodyVelocity,0.1) 
		end

	end
end)

Combat

wait(1)
--\\ Services //--

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")

--\\ Variables //--

local Debounce = false

local HiBo = game.ReplicatedStorage.Hitbox

local Count = 1

--\\ Functions //--

local function CombatActivation(Player, Action)
	
	
	local Character = Player.Character
	
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	
	local HM = Character:FindFirstChild("Humanoid")
	
	local HumanoidRootPart = Character.HumanoidRootPart
	
	local Humanoid = Character.Humanoid
	
	
	 
if Action == ("Combat") then
		
	--Hitbox Making
		local HitBox = HiBo:Clone()
		HitBox.CFrame = Character.PrimaryPart.CFrame * CFrame.new(0, 0, -3)
		local Welds = Instance.new("WeldConstraint", Character.PrimaryPart)
		Welds.Part0 = Character.PrimaryPart
		Welds.Part1 = HitBox
		HitBox.Parent = workspace
		
		
	--Region3 Creation
		local pos1 = HitBox.Position - (HitBox.Size/2)
		local pos2 = HitBox.Position + (HitBox.Size/2)
		local Re3 = Region3.new(pos1, pos2)
		
		
	--Region3 In Action
		local HBFinder = workspace:FindPartsInRegion3(Re3, HitBox, 20)
		Debris:AddItem(HitBox, 0.3)
		for i, parts in pairs (HBFinder) do
			if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
				parts.Parent.Humanoid:TakeDamage(2.5)
				local m1STUNT = Instance.new("BoolValue")
				m1STUNT.Name = "eStun"
				m1STUNT.Parent = Character
				game.Debris:AddItem(m1STUNT,.7)

				if m1STUNT.Parent == parts then
					m1STUNT = true
					local NoMoving = Character.Humanoid.WalkSpeed == 0
					local NoJumping = false
					if NoJumping == true then return end
					if NoJumping == false then
					local bodyVelocity = Instance.new('BodyVelocity')
					bodyVelocity.Parent = Character.HumanoidRootPart
					bodyVelocity.MaxForce = Vector3.new(0, 0, 0)
					bodyVelocity.P = Vector3.new(0, 0, 0)
					Character.Humanoid.WalkSpeed = NoMoving
					
					print("Stun locked")
						m1STUNT = false
					end
				end
				break
			end-- If statement ended in forloop
		end--For loop ended
		if Humanoid.Died then
			Humanoid.Died:Connect(function()
				if Humanoid.Died then
					HitBox:Destroy()
					script.Disabled = true
				end--If statement if the humanoid died
			end)--Humanoid died event
		end
	end-- if statement for combat activation on
end--Function End
 


script.Parent.OnServerEvent:Connect(CombatActivation)
--Region3 In Action
		local HBFinder = workspace:FindPartsInRegion3(Re3, HitBox, 20)
		Debris:AddItem(HitBox, 0.3)
		for i, parts in pairs (HBFinder) do
			if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
				parts.Parent.Humanoid:TakeDamage(2.5)
				local m1STUNT = Instance.new("BoolValue")
				m1STUNT.Name = "eStun"
				m1STUNT.Parent = Character
				game.Debris:AddItem(m1STUNT,.7)

				if m1STUNT.Parent == parts then
					m1STUNT = true
					local NoMoving = 0
					local NoJumping = false
					if NoJumping == true then return end

					if NoJumping == false then
					local bodyVelocity = Instance.new('BodyVelocity')
					bodyVelocity.Parent = Character.HumanoidRootPart
					bodyVelocity.MaxForce = Vector3.new(0, 0, 0)
					bodyVelocity.P = Vector3.new(0, 0, 0)
					Character.Humanoid.WalkSpeed = NoMoving
					
					print("Stun locked")
						m1STUNT = false
					end
				end
				break
			end-- If statement ended in forloop
		end--For loop ended

Also, I think there’s some syntax errors, not sure but check in studio since I’m on mobile. And I recommend us GetPartBoundsInBox instead of region3

What could the syntax issues be +
The Stun doesn’t seem to do anything to the player I’m hitting and they can just walk away with ease.

	local HBFinder = workspace:FindPartsInRegion3(Re3, HitBox, 20)
		Debris:AddItem(HitBox, 0.17)
		for i, parts in pairs (HBFinder) do
			if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
				parts.Parent.Humanoid:TakeDamage(2.5)
				local HMP = parts.Parent:FindFirstChild("Humanoid")
				local M1Stun = Instance.new("BoolValue")
				M1Stun.Name = "Stun"
				M1Stun.Parent = parts.Parent:FindFirstChild("Humanoid")
				Debris:AddItem(M1Stun, 0.19)
				
				if M1Stun.Parent == parts.Parent:FindFirstChild("Humanoid") then
					if M1Stun == true then return end					
					M1Stun = true
					HMP.WalkSpeed = 0
					HMP.JumpPower = 0
					print("Stunlocked")	
					M1Stun = false
				end
				break
			end-- If statement ended in forloop
		end--For loop ended

Well, I fixed it to a certain extent. Now the issue is that the script doesn’t keep the properties it’s meant to keep, and just exists without doing anything.