How do I implement an AOE cone into my tower defense script?

So, I’m trying to make an AOE cone attack, but have NO idea how to sense enemies in a cone. How would I make it using the script below?

function tower.Attack(newTower, player)
	
	local config = newTower.Config
	local target = tower.FindTarget(newTower, config.Range.Value, config.TargetMode.Value)
	
	if target ~= nil and target:FindFirstChild("Humanoid") then
		
		AnimateEvent:FireAllClients(newTower, "Attack", target)
		if target then
			local targetCFrame = CFrame.lookAt(newTower.HumanoidRootPart.Position, target.HumanoidRootPart.Position)
			
			newTower.HumanoidRootPart.BodyGyro.CFrame = targetCFrame
		end
		
		abilities(newTower, config, target, player, config.TargetMode.Value)
		
		damage(target, config)
		
		task.wait(config.Cooldown.Value)
	end

	task.wait(0.05)

	if newTower and newTower.Parent then
		tower.Attack(newTower, player)
		
	end
end
1 Like