How do I stop my Damage Script from lagging the game?

I’m having issues with the script causing lag in my game, I’ve tried to remove lines of code, but I don’t know how to fix it.

-- local DamageEvent = game.ReplicatedStorage.Events.DamageEvent
local ServerItems = game.ServerStorage.ServerItems

local Debris = game:GetService("Debris")
local Abb = require(game.ReplicatedStorage.Abbreviate)

local function Indicator(Player, Enemy, Damage, Suffix, OColor, TColor)
	local Indicator = Instance.new("Part")
	Indicator.Shape = Enum.PartType.Ball
	Indicator.Color = OColor
	Indicator.CastShadow = false
	Indicator.Material = Enum.Material.Neon
	Indicator.Transparency = 0
	Indicator.Size = Vector3.new(1, 1, 1)
	Indicator.CanCollide = false
	Indicator.Anchored = true
	Indicator.CFrame = Enemy:FindFirstChild("HumanoidRootPart").CFrame + Vector3.new(Random.new():NextNumber(-1.5, 1.5), 6, Random.new():NextNumber(-1.5, 1.5))

	local IndicatorUI = ServerItems:FindFirstChild("IndicatorUI"):Clone()
	IndicatorUI.Parent = Indicator
	IndicatorUI.Adornee = Indicator

	local IndicatorText = IndicatorUI:FindFirstChild("IndicatorText")
	IndicatorText.Text = Abb.Convert(Damage, "Advanced")..Suffix
	IndicatorText.TextColor3 = TColor

	local IndicatorC = Indicator:Clone()

	Debris:AddItem(IndicatorC, 2.5)
	IndicatorC.Parent = game.Workspace
end

local function Hit(Player, Weapon, Enemy)	
	local WeaponSettings = require(Weapon:WaitForChild("WeaponScripts"):WaitForChild("WeaponSettings"))
	local WeaponMinDamage = WeaponSettings.WeaponMinDamage
	local WeaponMaxDamage = WeaponSettings.WeaponMaxDamage
	local Cooldown = WeaponSettings.Cooldown
	local CritChance = WeaponSettings.CritChance
	local MissChance = WeaponSettings.MissChance
	
	local ArmorSettingsCheck = Player.Character:FindFirstChild("ArmorSettings", true)
	local ArmorSettings
	if ArmorSettingsCheck ~= nil then
		ArmorSettings = require(ArmorSettingsCheck)
	else
		ArmorSettings = nil
	end
	
	local HitSound = script:WaitForChild("HitSound")
	local HitSoundC = HitSound:Clone()
	
	if (not Enemy) then
		return
	elseif Enemy:FindFirstChild("Enemy") then
		local EnemyHealthValue = Enemy:FindFirstChild("EnemyHealthValue", true)
		local EnemyDefenseValue = Enemy:FindFirstChild("EnemyDefenseValue", true)

		local DR = 1 - EnemyDefenseValue.Value / 100
		
		local AddedDamage
		if ArmorSettings ~= nil then
			if WeaponSettings.WeaponClass == ArmorSettings.ArmorClass then
				AddedDamage = ArmorSettings.ArmorDamage
			else
				AddedDamage = 0
			end
		else
			AddedDamage = 0
		end
		
		if EnemyHealthValue.Value > 0 then
			local CombinedChance = CritChance + MissChance
			local Chances = {
				["Crit"] = CritChance,
				["Miss"] = MissChance,
				["Normal"] = 100 - CombinedChance,
			}

			local function GetChances(OrderedTable)
				local TotalWeight = 0

				for Piece, Weight in pairs(OrderedTable) do
					TotalWeight = TotalWeight + Weight
				end

				local Chance = math.random(1, TotalWeight)
				local Counter = 0
				for Hit, Weight in pairs(OrderedTable) do
					Counter = Counter + Weight
					if Chance <= Counter then
						return Hit
					end
				end
			end
			
			local Hit = GetChances(Chances)
			if  Hit == "Crit" then
				local Damage = math.round((Random.new():NextNumber(WeaponMinDamage * 2, WeaponMaxDamage * 2) + AddedDamage) * DR)
				local Suffix = " Damage! (Crit)"
				local OColor = Color3.fromRGB(255, 255, 0)
				local TColor = Color3.fromRGB(255, 255, 0)
				Indicator(Player, Enemy, Damage, Suffix, OColor, TColor)
				Debris:AddItem(HitSoundC, 1)
				HitSoundC.Parent = Enemy:WaitForChild("HumanoidRootPart")
				HitSoundC:Play()
				EnemyHealthValue.Value -= Damage
			elseif Hit == "Miss" then
				local Damage = 0
				local Suffix = " Damage... (Miss)"
				local OColor = Color3.fromRGB(0, 85, 255)
				local TColor = Color3.fromRGB(0, 85, 255)
				Indicator(Player, Enemy, Damage, Suffix, OColor, TColor)
				EnemyHealthValue.Value -= 0
			elseif Hit == "Normal" then
				local Damage = math.round((Random.new():NextNumber(WeaponMinDamage, WeaponMaxDamage) + AddedDamage) * DR)
				local Suffix = " Damage"
				local OColor = Color3.fromRGB(255, 0, 0)
				local TColor = Color3.fromRGB(255, 255, 255)
				Indicator(Player, Enemy, Damage, Suffix, OColor, TColor)
				Debris:AddItem(HitSoundC, 1)
				HitSoundC.Parent = Enemy:WaitForChild("HumanoidRootPart")
				HitSoundC:Play()
				EnemyHealthValue.Value -= Damage
			end
		end
	end
end

local function Tag(Player, Enemy)
	local Tag = Instance.new("ObjectValue")
	Tag.Name = Player.Name
	Tag.Value = Player
	Debris:AddItem(Tag, math.huge)
	Tag.Parent = Enemy.Enemy.TagFolder
end

local function UnTag(Player, Enemy)
	for i, v in pairs(Enemy.Enemy.TagFolder:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == Player.Name then
			v:Destroy()
		end
	end
end

local function HyperTag(Player, Enemy)
	if (not Enemy) then
		return
	elseif Enemy:FindFirstChild("Enemy") then
		UnTag(Player, Enemy)
		Tag(Player, Enemy)
	end
end

local function EnemyScreenInfo(Player, Enemy)
	local EnemyScreenInfo = ServerItems.EnemyScreenInfo
	local PlayerMain = Player:WaitForChild("PlayerGui"):WaitForChild("PlayerMain")
	
	local ExistingEnemyScreenInfo = PlayerMain:FindFirstChild("EnemyScreenInfo")
	if (ExistingEnemyScreenInfo and ExistingEnemyScreenInfo:FindFirstChildWhichIsA("ObjectValue").Value == Enemy) and Enemy:FindFirstChild("Enemy") then
		return
	elseif Enemy ~= workspace then
		if ExistingEnemyScreenInfo then
			ExistingEnemyScreenInfo:Destroy()
		end
		
		local EnemyScreenInfoC = EnemyScreenInfo:Clone()

		local EnemyValue = Instance.new("ObjectValue")
		EnemyValue.Value = Enemy
		EnemyValue.Parent = EnemyScreenInfoC

		local WorldModel = EnemyScreenInfoC:FindFirstChildWhichIsA("WorldModel", true)	
		local EnemyC = Enemy:Clone()
		for _, Descendant in pairs(EnemyC:GetDescendants()) do
			if Descendant:IsA("Script") then
				Descendant:Destroy()
			end
		end
		EnemyC.Parent = WorldModel

		EnemyScreenInfoC.Parent = PlayerMain
	else
		return
	end
end

local DebounceTable = {}

game.Players.PlayerAdded:Connect(function(Player)
	if not DebounceTable[Player.Name] then
		DebounceTable[Player.Name] = tick() - 60
	end
end)

game.Players.PlayerRemoving:Connect(function(Player)
	if DebounceTable[Player.Name] then
		DebounceTable[Player.Name] = nil
	end
end)


DamageEvent.OnServerEvent:Connect(function(Player, Weapon, Enemy)
	if tick() - DebounceTable[Player.Name] >= require(Weapon:WaitForChild("WeaponScripts"):WaitForChild("WeaponSettings")).Cooldown then
		Hit(Player, Weapon, Enemy)
		HyperTag(Player, Enemy)
		EnemyScreenInfo(Player, Enemy)
		DebounceTable[Player.Name] = tick()
	end
end)

^ This is the script

When you’re play testing can you at least pinpoint the point at which the lag starts?

That could help us know where in the code too look for the issue.

I would think that requiring the module every time a hit is detected is not going to help matters. Look at optimising the way in which you reference that data after loading the module only once.

A bit late but it seems to be the rate of the script