Charge impacting causes sudden freeze without warning or brief lagging

Hello Developers!

This is a snippet from a charging code, as you can clearly see, during the repeat loop, the player is forced to charge forward and whenever you hit someone, they’ll be dealt some damage, ragdolled, and knockbacked. The only issue is the Plr.Character.Torso:Connect(function(OnHit) function, it will sometimes cause sudden freeze without any warning or brief lagging.

local VelocitySpeed = 230
		local ChargeTime = 2.5
		local Timer = tick()
		local Hits = {}
		repeat
			Plr.Character.HumanoidRootPart.AssemblyLinearVelocity = Plr.Character.HumanoidRootPart.CFrame.LookVector * VelocitySpeed
			--[[
			for _, BodyParts in pairs(Plr.Character:GetChildren()) do
				if BodyParts:IsA("BasePart") and BodyParts ~= Plr.Character.HumanoidRootPart then
					local DebrisPart = BodyParts:Clone()
					game:GetService("Debris"):AddItem(DebrisPart,0.8)
					DebrisPart.CanCollide = false
					DebrisPart.Transparency = 0.5
					DebrisPart.Material = Enum.Material.Neon
					DebrisPart.BrickColor = BrickColor.new("Sunrise")
					DebrisPart.Parent = workspace.Debris
					--task.wait(.08)
				end
			end
			]]
			Plr.Character.Torso.Touched:Connect(function(OnHit)
				local Character = OnHit:FindFirstAncestorWhichIsA("Model")
				local Humanoid = Character and Character:FindFirstChildWhichIsA("Humanoid")
				if Humanoid and Humanoid.Health >= 1 and not Hits[Character] and Humanoid ~= Plr.Character.Humanoid then
					Hits[Character] = true
					Humanoid:TakeDamage(35)
					KnockbackandRagdoll(Character)
					task.wait(0.3)
					Hits[Character] = false
				end
				task.wait(3)
				Unragdolled(Character)
			end)
			task.wait()
		until tick() - ChargeTime >= Timer or not Plr.Character

You only need to call the Touched event once, so there is no need for the repeat.

Alright then, thanks. I’ll do it