Why is my npc move like that

Here’s the prolem
https://gyazo.com/116df0a50226310d62cd4f6c987d5a22
My NPC do something wried like in the gif when i do the air combo
the normal attack is fine.
Here’s the uplit air slam down script
local HitEffect = RS.Effects.Effects.HitEffect.Hiteffect:Clone()

	local Hitbox1 = Instance.new("Part")
	Hitbox1.Size = Vector3.new(4.126, 4.186, 8.642)--6.442
	Hitbox1.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector * 0.5
	Hitbox1.Anchored = true
	Hitbox1.CanCollide = false
	--Hitbox1.Parent = game.Workspace.FX

	if not FindStunInCharacter and Character:WaitForChild("Humanoid").Health > 0 then



		local op = OverlapParams.new()
		op.FilterDescendantsInstances = {Character}
		op.FilterType = Enum.RaycastFilterType.Blacklist
		local parts = workspace:GetPartsInPart(Hitbox1,op)

		local debounce = false

		for _,hit in pairs(parts) do
			if hit.Parent and hit.Parent ~= Character and not FindStunInCharacter and hit.Parent:FindFirstChildWhichIsA("Humanoid") and debounce == false then
				local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid")
				local FF1 = hit.Parent:FindFirstChild("BlockHits")
				local Immune = hit.Parent:FindFirstChild("Immune")
				local Model = hit.Parent:IsA("Model")
				------------------------------------------------------------------------------
				local Bovy = Instance.new("BodyVelocity")
				Bovy.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				Bovy.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 32
				local B = Instance.new("BodyVelocity")
				B.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				B.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 4
				local B1 = Instance.new("BodyVelocity")
				B1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				B1.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 80 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 35
				-------------------------------------------------------------------------------

				local function Effecthit()

					hum:LoadAnimation(game.ReplicatedStorage.Animations.Air.Animation2):Play()

				end

				local function FindSomethingToDeleteBeforeHit()
					for i,v in pairs(hit.Parent.HumanoidRootPart:GetChildren()) do

						if v:IsA("BodyVelocity") or v:IsA("BodyGyro") or v:IsA("BodyPosition") then
							game.Debris:AddItem(v,0)
						elseif v:IsA("BodyForce") then
							game.Debris:AddItem(v,0)

						end
					end
					for i,v in pairs(hit.Parent.Effects:GetChildren()) do

						if v.Name == "Ragdoll" then
							game.Debris:AddItem(v,0)


						end
					end
				end


				local HittedAnEnemy = Character:FindFirstChild("HittedAnEnemy")

				if hum and not FF1 and hum.Health > 0 and not Immune and Model then
					debounce = true
					hum:TakeDamage(15)
					Player.leaderstats.Damage.Value = Player.leaderstats.Damage.Value + 15
					FindSomethingToDeleteBeforeHit()
					--B.Parent = Character.HumanoidRootPart
					--B1.Parent = hit.Parent.HumanoidRootPart


					local Fj1



					local fkf = coroutine.create(function()
						local KDj1sfFdsx = HumRoot.CFrame + HumRoot.CFrame.LookVector * 15

						FindSomethingToDeleteBeforeHit()


						hit.Parent.HumanoidRootPart.Anchored = true

						local params = RaycastParams.new()
						params.FilterType = Enum.RaycastFilterType.Blacklist
						params.FilterDescendantsInstances = {workspace.FX,workspace.Bodies}







						local ra11y = workspace:Raycast(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame.LookVector * 15, params)

						--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("tweenAir",hit.Parent.HumanoidRootPart,0.15,endCF)
						
						
						if ra11y then
							hit.Parent.HumanoidRootPart.Anchored = true
							FindSomethingToDeleteBeforeHit()
							local partCache123 = require(game.ReplicatedStorage.Modules.PartCache).new(Instance.new("Part"),1,workspace.FX)
							local Part124 = partCache123:GetPart()
							Part124.Size = Vector3.new(1, 1, 1)--6.442
							Part124.Position = ra11y.Position
							Part124.Anchored = true
							Part124.Transparency = 1
							Part124.CanCollide = false
							Part124.Massless = true
							Part124.CastShadow = false

							game.Debris:AddItem(Part124,1.4)

							local ray = Ray.new(Part124.Position, Vector3.new(0, -1000000000, 0))
							local hit2, vec2Pos, surfaceNormal = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.FX,workspace.Bodies})
							local angle	= math.rad(math.random(360))

							local endCF = CFrame.new(vec2Pos, vec2Pos + surfaceNormal) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.Angles(0, angle, 0) * CFrame.new(0,1.5,0) --* HumRoot.CFrame * CFrame.new(0,0,-5)

							local DKksf = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.LookVector * 5

							Effecthit()
							Damage:FireAllClients("DamageHit",hit.Parent.HumanoidRootPart,15,Color3.new(0.027451, 0.0196078, 0.0627451))

							hit.Parent.HumanoidRootPart.Position =  endCF.Position + Vector3.new(0,0.005,0)


							local JD124 = game.ReplicatedStorage.Effects.Effects.EffectGround12367:Clone()
							JD124.CanCollide = false
							JD124.Position = endCF.Position + Vector3.new(0,3,0)

							--JD124.Attachment5.Smoke.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,ra11y.Instance.Color),ColorSequenceKeypoint.new(1,ra11y.Instance.Color)}
							JD124.Attachment5.Smoke.Enabled = false
							JD124.Parent = game.Workspace.FX

							JD124.Attachment5.Smoke:Emit(8)
							JD124.Attachment5.FillStar1:Emit(2)
							JD124.Attachment.Ring:Emit(2)
							JD124.Attachment.Shadow:Emit(1)
							--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("FlyingDebris",JD124.Position + Vector3.new(0,-0.5,0),4,0,Character)

							game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("Rock1sdx",JD124)

							game.Debris:AddItem(JD124,5)

							game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(Player)
							if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
								local P1 = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
								game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(P1)

							end
							task.wait(0.1)
							hit.Parent.HumanoidRootPart.Anchored = false	
						else
							hit.Parent.HumanoidRootPart.Anchored = true
							FindSomethingToDeleteBeforeHit()
							local partCache123 = require(game.ReplicatedStorage.Modules.PartCache).new(Instance.new("Part"),1,workspace.FX)
							local Part124 = partCache123:GetPart()
							Part124.Size = Vector3.new(1, 1, 1)--6.442
							Part124.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector * 13
							Part124.Anchored = true
							Part124.Transparency = 1
							Part124.CanCollide = false
							Part124.Massless = true
							Part124.CastShadow = false

							game.Debris:AddItem(Part124,1.4)
							--workspace.FX,workspace.Bodies
							local ray = Ray.new(Part124.Position, Vector3.new(0, -1000000000, 0))
							local hit2, vec2Pos, surfaceNormal = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.FX,workspace.Bodies})
							local angle	= math.rad(math.random(360))

							local endCF = CFrame.new(vec2Pos, vec2Pos + surfaceNormal) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.Angles(0, angle, 0) * CFrame.new(0,1.5,0) --* HumRoot.CFrame * CFrame.new(0,0,-5)

							local DKksf = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.LookVector * 5

							Effecthit()
							Damage:FireAllClients("DamageHit",hit.Parent.HumanoidRootPart,15,Color3.new(0.027451, 0.0196078, 0.0627451))

							hit.Parent.HumanoidRootPart.Position =  endCF.Position + Vector3.new(0,0.005,0)
							hit.Parent.HumanoidRootPart.Anchored = false								

							local JD124 = game.ReplicatedStorage.Effects.Effects.EffectGround12367:Clone()
							JD124.CanCollide = false
							JD124.Position = endCF.Position + Vector3.new(0,3,0)

							--JD124.Attachment5.Smoke.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,ra11y.Instance.Color),ColorSequenceKeypoint.new(1,ra11y.Instance.Color)}
							JD124.Attachment5.Smoke.Enabled = false
							JD124.Parent = game.Workspace.FX

							JD124.Attachment5.Smoke:Emit(8)
							JD124.Attachment5.FillStar1:Emit(2)
							JD124.Attachment.Ring:Emit(2)
							JD124.Attachment.Shadow:Emit(1)
							--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("FlyingDebris",JD124.Position + Vector3.new(0,-0.5,0),4,0,Character)

							game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("Rock1sdx",JD124)

							game.Debris:AddItem(JD124,5)

							game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(Player)
							if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
								local P1 = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
								game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(P1)

							end
							task.wait(0.1)
							hit.Parent.HumanoidRootPart.Anchored = false	
						end


					end)

					coroutine.resume(fkf)






					game.Debris:AddItem(HittedAnEnemy,0)



					Combo.Value = Combo.Value + 1


					StunValueModule.Stun(hit.Parent,1.5)
					StunWalkSpeedModule.Stun(hum,1.5)
					if hit.Parent:FindFirstChild("AttackedByWho").Value == nil then
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					else
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					end

					delay(0.2,function()

						hit.Parent:FindFirstChild("AttackedByWho").Value = nil

					end)
				elseif hum and FF1 and hum.Health > 0 and not Immune and Model and hit.Parent:FindFirstChild("BlockHits").Value > 0 and hit.Name == "BlockPad" then
					debounce = true
					local BlockS1 = hit.Parent:FindFirstChild("BlockHits")

					BlockS1.Value = BlockS1.Value - 1
					local NH = game.ReplicatedStorage.Effects.Effects.BlockEf.Ring:Clone()
					NH.Parent = hit.Parent.HumanoidRootPart

					NH.Ring:Emit(1)
					if hit.Parent:FindFirstChild("AttackedByWho").Value == nil then
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					else
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					end

					delay(0.2,function()

						hit.Parent:FindFirstChild("AttackedByWho").Value = nil

					end)
					game.Debris:AddItem(NH,2)
					if BlockS1.Value <= 0 then
						local BH1 = Instance.new("BoolValue",hit.Parent)
						BH1.Name = "Stun"
						
						
						game.Debris:AddItem(BH1,1.8)
						for i,v in pairs(hit.Parent:GetChildren()) do


							if v.Name == "BlockUItach" then

								game.Debris:AddItem(v,0)

							end
							game.Debris:AddItem(v:FindFirstChild("BlockPad"),0.1)
							game.Debris:AddItem(hit.Parent.HumanoidRootPart:FindFirstChild("BlockPad"),0.1)

							game.Debris:AddItem(BlockS1,0.1)	
						end


						for i,v in pairs(hit.Parent:FindFirstChild("Humanoid"):GetPlayingAnimationTracks()) do
							v:Stop()
						end

						hum:LoadAnimation(game.ReplicatedStorage.Animations.Knockback.Animation):Play()
						
						game.Debris:AddItem(hit.Parent:FindFirstChild("BlockPad"),0.1)
						game.Debris:AddItem(hit.Parent.HumanoidRootPart:FindFirstChild("BlockPad"),0.1)
						
					end

				end
			end
		end

This is up script
local HitEffect = RS.Effects.Effects.HitEffect.Hiteffect:Clone()

	local Hitbox1 = Instance.new("Part")
	Hitbox1.Size = Vector3.new(4.126, 4.186, 8.642)--6.442
	Hitbox1.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector * 0.5
	Hitbox1.Anchored = true
	Hitbox1.CanCollide = false
	--Hitbox1.Parent = game.Workspace.FX

	if not FindStunInCharacter and Character:WaitForChild("Humanoid").Health > 0 then



		local op = OverlapParams.new()
		op.FilterDescendantsInstances = {Character}
		op.FilterType = Enum.RaycastFilterType.Blacklist
		local parts = workspace:GetPartsInPart(Hitbox1,op)

		local debounce = false

		for _,hit in pairs(parts) do
			if hit.Parent and hit.Parent ~= Character and not FindStunInCharacter and hit.Parent:FindFirstChildWhichIsA("Humanoid") and debounce == false then
				local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid")
				local FF1 = hit.Parent:FindFirstChild("BlockHits")
				local Immune = hit.Parent:FindFirstChild("Immune")
				local Model = hit.Parent:IsA("Model")
				------------------------------------------------------------------------------
				local Bovy = Instance.new("BodyVelocity")
				Bovy.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				Bovy.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 32
				local B = Instance.new("BodyVelocity")
				B.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				B.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 4
				local B1 = Instance.new("BodyVelocity")
				B1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				B1.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 80 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 35
				-------------------------------------------------------------------------------

				local function Effecthit()

					hum:LoadAnimation(game.ReplicatedStorage.Animations.Air.Animation2):Play()

				end

				local function FindSomethingToDeleteBeforeHit()
					for i,v in pairs(hit.Parent.HumanoidRootPart:GetChildren()) do

						if v:IsA("BodyVelocity") or v:IsA("BodyGyro") or v:IsA("BodyPosition") then
							game.Debris:AddItem(v,0)
						elseif v:IsA("BodyForce") then
							game.Debris:AddItem(v,0)

						end
					end
					for i,v in pairs(hit.Parent.Effects:GetChildren()) do

						if v.Name == "Ragdoll" then
							game.Debris:AddItem(v,0)


						end
					end
				end


				local HittedAnEnemy = Character:FindFirstChild("HittedAnEnemy")

				if hum and not FF1 and hum.Health > 0 and not Immune and Model then
					debounce = true
					hum:TakeDamage(15)
					Player.leaderstats.Damage.Value = Player.leaderstats.Damage.Value + 15
					FindSomethingToDeleteBeforeHit()
					--B.Parent = Character.HumanoidRootPart
					--B1.Parent = hit.Parent.HumanoidRootPart


					local Fj1



					local fkf = coroutine.create(function()
						local KDj1sfFdsx = HumRoot.CFrame + HumRoot.CFrame.LookVector * 15

						FindSomethingToDeleteBeforeHit()


						hit.Parent.HumanoidRootPart.Anchored = true

						local params = RaycastParams.new()
						params.FilterType = Enum.RaycastFilterType.Blacklist
						params.FilterDescendantsInstances = {workspace.FX,workspace.Bodies}







						local ra11y = workspace:Raycast(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame.LookVector * 15, params)

						--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("tweenAir",hit.Parent.HumanoidRootPart,0.15,endCF)
						
						
						if ra11y then
							hit.Parent.HumanoidRootPart.Anchored = true
							FindSomethingToDeleteBeforeHit()
							local partCache123 = require(game.ReplicatedStorage.Modules.PartCache).new(Instance.new("Part"),1,workspace.FX)
							local Part124 = partCache123:GetPart()
							Part124.Size = Vector3.new(1, 1, 1)--6.442
							Part124.Position = ra11y.Position
							Part124.Anchored = true
							Part124.Transparency = 1
							Part124.CanCollide = false
							Part124.Massless = true
							Part124.CastShadow = false

							game.Debris:AddItem(Part124,1.4)

							local ray = Ray.new(Part124.Position, Vector3.new(0, -1000000000, 0))
							local hit2, vec2Pos, surfaceNormal = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.FX,workspace.Bodies})
							local angle	= math.rad(math.random(360))

							local endCF = CFrame.new(vec2Pos, vec2Pos + surfaceNormal) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.Angles(0, angle, 0) * CFrame.new(0,1.5,0) --* HumRoot.CFrame * CFrame.new(0,0,-5)

							local DKksf = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.LookVector * 5

							Effecthit()
							Damage:FireAllClients("DamageHit",hit.Parent.HumanoidRootPart,15,Color3.new(0.027451, 0.0196078, 0.0627451))

							hit.Parent.HumanoidRootPart.Position =  endCF.Position + Vector3.new(0,0.005,0)


							local JD124 = game.ReplicatedStorage.Effects.Effects.EffectGround12367:Clone()
							JD124.CanCollide = false
							JD124.Position = endCF.Position + Vector3.new(0,3,0)

							--JD124.Attachment5.Smoke.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,ra11y.Instance.Color),ColorSequenceKeypoint.new(1,ra11y.Instance.Color)}
							JD124.Attachment5.Smoke.Enabled = false
							JD124.Parent = game.Workspace.FX

							JD124.Attachment5.Smoke:Emit(8)
							JD124.Attachment5.FillStar1:Emit(2)
							JD124.Attachment.Ring:Emit(2)
							JD124.Attachment.Shadow:Emit(1)
							--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("FlyingDebris",JD124.Position + Vector3.new(0,-0.5,0),4,0,Character)

							game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("Rock1sdx",JD124)

							game.Debris:AddItem(JD124,5)

							game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(Player)
							if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
								local P1 = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
								game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(P1)

							end
							task.wait(0.1)
							hit.Parent.HumanoidRootPart.Anchored = false	
						else
							hit.Parent.HumanoidRootPart.Anchored = true
							FindSomethingToDeleteBeforeHit()
							local partCache123 = require(game.ReplicatedStorage.Modules.PartCache).new(Instance.new("Part"),1,workspace.FX)
							local Part124 = partCache123:GetPart()
							Part124.Size = Vector3.new(1, 1, 1)--6.442
							Part124.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector * 13
							Part124.Anchored = true
							Part124.Transparency = 1
							Part124.CanCollide = false
							Part124.Massless = true
							Part124.CastShadow = false

							game.Debris:AddItem(Part124,1.4)
							--workspace.FX,workspace.Bodies
							local ray = Ray.new(Part124.Position, Vector3.new(0, -1000000000, 0))
							local hit2, vec2Pos, surfaceNormal = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.FX,workspace.Bodies})
							local angle	= math.rad(math.random(360))

							local endCF = CFrame.new(vec2Pos, vec2Pos + surfaceNormal) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.Angles(0, angle, 0) * CFrame.new(0,1.5,0) --* HumRoot.CFrame * CFrame.new(0,0,-5)

							local DKksf = hit.Parent.HumanoidRootPart.CFrame + hit.Parent.HumanoidRootPart.CFrame.LookVector * 5

							Effecthit()
							Damage:FireAllClients("DamageHit",hit.Parent.HumanoidRootPart,15,Color3.new(0.027451, 0.0196078, 0.0627451))

							hit.Parent.HumanoidRootPart.Position =  endCF.Position + Vector3.new(0,0.005,0)
							hit.Parent.HumanoidRootPart.Anchored = false								

							local JD124 = game.ReplicatedStorage.Effects.Effects.EffectGround12367:Clone()
							JD124.CanCollide = false
							JD124.Position = endCF.Position + Vector3.new(0,3,0)

							--JD124.Attachment5.Smoke.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,ra11y.Instance.Color),ColorSequenceKeypoint.new(1,ra11y.Instance.Color)}
							JD124.Attachment5.Smoke.Enabled = false
							JD124.Parent = game.Workspace.FX

							JD124.Attachment5.Smoke:Emit(8)
							JD124.Attachment5.FillStar1:Emit(2)
							JD124.Attachment.Ring:Emit(2)
							JD124.Attachment.Shadow:Emit(1)
							--game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("FlyingDebris",JD124.Position + Vector3.new(0,-0.5,0),4,0,Character)

							game.ReplicatedStorage.RemoteEvents.ClientScreenEffectService:FireAllClients("Rock1sdx",JD124)

							game.Debris:AddItem(JD124,5)

							game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(Player)
							if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
								local P1 = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
								game.ReplicatedStorage.Modules.Remotes.Camera.BumpRemaked:FireClient(P1)

							end
							task.wait(0.1)
							hit.Parent.HumanoidRootPart.Anchored = false	
						end


					end)

					coroutine.resume(fkf)






					game.Debris:AddItem(HittedAnEnemy,0)



					Combo.Value = Combo.Value + 1


					StunValueModule.Stun(hit.Parent,1.5)
					StunWalkSpeedModule.Stun(hum,1.5)
					if hit.Parent:FindFirstChild("AttackedByWho").Value == nil then
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					else
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					end

					delay(0.2,function()

						hit.Parent:FindFirstChild("AttackedByWho").Value = nil

					end)
				elseif hum and FF1 and hum.Health > 0 and not Immune and Model and hit.Parent:FindFirstChild("BlockHits").Value > 0 and hit.Name == "BlockPad" then
					debounce = true
					local BlockS1 = hit.Parent:FindFirstChild("BlockHits")

					BlockS1.Value = BlockS1.Value - 1
					local NH = game.ReplicatedStorage.Effects.Effects.BlockEf.Ring:Clone()
					NH.Parent = hit.Parent.HumanoidRootPart

					NH.Ring:Emit(1)
					if hit.Parent:FindFirstChild("AttackedByWho").Value == nil then
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					else
						hit.Parent:FindFirstChild("AttackedByWho").Value = Character
					end

					delay(0.2,function()

						hit.Parent:FindFirstChild("AttackedByWho").Value = nil

					end)
					game.Debris:AddItem(NH,2)
					if BlockS1.Value <= 0 then
						local BH1 = Instance.new("BoolValue",hit.Parent)
						BH1.Name = "Stun"
						
						
						game.Debris:AddItem(BH1,1.8)
						for i,v in pairs(hit.Parent:GetChildren()) do


							if v.Name == "BlockUItach" then

								game.Debris:AddItem(v,0)

							end
							game.Debris:AddItem(v:FindFirstChild("BlockPad"),0.1)
							game.Debris:AddItem(hit.Parent.HumanoidRootPart:FindFirstChild("BlockPad"),0.1)

							game.Debris:AddItem(BlockS1,0.1)	
						end


						for i,v in pairs(hit.Parent:FindFirstChild("Humanoid"):GetPlayingAnimationTracks()) do
							v:Stop()
						end

						hum:LoadAnimation(game.ReplicatedStorage.Animations.Knockback.Animation):Play()
						
						game.Debris:AddItem(hit.Parent:FindFirstChild("BlockPad"),0.1)
						game.Debris:AddItem(hit.Parent.HumanoidRootPart:FindFirstChild("BlockPad"),0.1)
						
					end

				end
			end
		end

https://gyazo.com/2f42bf24f9cb2c48422dc6ddc4ea51e3
Hope you guys can help me :sunglasses:

1 Like

Can give me your NPC script? Because maybe its the script or the Walkspeed.

Here

local npc = script.Parent
local hrpOfNPC = npc:WaitForChild(“HumanoidRootPart”)

local plrsHit = {}

local maxDistance = 80
local maxDistance1 = 200
local CombaDistancet = 8

local ServerStorage = game:GetService(“ReplicatedStorage”).Modules
local NPC = script.Parent
local SimplePath = require(ServerStorage.SimplePath)
local Path = SimplePath.new(NPC)
local direction = game.Workspace.FX.Stay

local Count = 1

local Debou = false

while wait() do

if script.Parent:WaitForChild("Humanoid").Health <= 0  then
	
	break
	
end

if not Debou and not npc:FindFirstChild("Stun") and script.Parent:WaitForChild("Humanoid").Health > 0 then
	
	local plrs = game.Players:GetPlayers()

	local closestHRP

	for i, plr in pairs(plrs) do

		if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") and plr.Character.Humanoid.Health > 0 then

			local hrp = plr.Character.HumanoidRootPart
			local hrp2 = plr.Character.PrimaryPart

			local distanceBetween = (hrpOfNPC.Position - hrp2.Position).Magnitude


			if not closestHRP then closestHRP = hrp2 end

			if (hrpOfNPC.Position - closestHRP.Position).Magnitude > distanceBetween then

				closestHRP = hrp2

			end
		end
	end



	if closestHRP and (hrpOfNPC.Position - closestHRP.Position).Magnitude <= maxDistance and not npc:FindFirstChild("Stun") and script.Parent:WaitForChild("Humanoid").Health > 0 then
		wait()
		script.Parent.CanAttack.Value = false
		Path:Run(closestHRP)
	else
		script.Parent.CanAttack.Value = true
	end
	
end

end
And Stun script for npc
local Character = script.Parent.Parent
local Humanoid = Character:WaitForChild(“Humanoid”)
local kJ1
kJ1 = game:GetService(“RunService”).Stepped:Connect(function()

if Character:FindFirstChild("Stun") then
	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0

end	

if Character:FindFirstChild("BlockHits") and not Character:FindFirstChild("Stun") then

	Humanoid.WalkSpeed = 5
	Humanoid.JumpPower = 30

end

if Character:FindFirstChild("YouHittedEnemy") and not Character:FindFirstChild("Stun") then

	Humanoid.WalkSpeed = 12
	Humanoid.JumpPower = 0

end

if Character:FindFirstChild("GuardBreak") then

	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0

end

end)
script.Parent.Parent.Humanoid.Died:connect(function()
kJ1:Disconnect()
end)

Whats the “Path” Module? (limmmmmmmmmmmmt)

it’s this module, i use this moudule becasue it made my npc smart

Use this script for now:

local NPC = script.Parent
local hrpOfNPC = npc:WaitForChild(“HumanoidRootPart”)

local plrsHit = {}

local RS = game:GetService("RunService")
local Players = game:GetService("Players")

print("Loaded vars. Canada!")

RS.RenderStepped:Connect(function()
for _,plr in pairs(Players:GetPlayers()) do
local charHRP = plr.Character:WaitForChild("HumanoidRootPart")
local mag =  (hrpOfNPC.Position - charHRP.Position).Magnitude

if mag > 10 then
--Script here!
end

end
end)

It works but he still walk like this https://gyazo.com/061f5494a3de421517539cfb51a86d74
after i did this https://gyazo.com/fa155ac33eb6cc66bba48faff8c45450

local NPC = script.Parent
local hrpOfNPC = npc:WaitForChild(“HumanoidRootPart”)

local plrsHit = {}

local RS = game:GetService("RunService")
local Players = game:GetService("Players")

print("Loaded vars. Canada!")

RS.RenderStepped:Connect(function()
for _,plr in pairs(Players:GetPlayers()) do
local charHRP = plr.Character:WaitForChild("HumanoidRootPart")
local mag =  (hrpOfNPC.Position - charHRP.Position).Magnitude

if mag > 10 then
--Script here!
NPC.Humanoid.Walkspeed = 30
elseif mag > 5 then
--Script here!
NPC.Humanoid.Walkspeed = 16
end

end
end)