Extreme Micro Profiler Spikes On Physics Stepped

Hello everyone! I hope you’re all having a good day.

I need help optimizing my enemy NPC code!!!

I’m getting major micro profiler spikes on physics stepped!

Code and microprofiler dump:

MatchStartedHandler (Server) local Players = game:GetService("Players")local Replicated = game:GetService(" - Pastebin.com
One of the AI local Scripts (client) local Replicated = game:GetService("ReplicatedStorage")local RunService = game - Pastebin.com

Link to micro profiler (google drive) microprofile-20240517-113426.html - Google Drive

No reason to do this:
raycastparams.FilterDescendantsInstances = workspace.SpawnedEnemies:GetChildren()
You can just do:
raycastparams.FilterDescendantsInstances = workspace.SpawnedEnemies