A way to create Enemy AI
With this showcase, we are taking reference from a video on a YouTube channel named “DevZoid”:
And made some scripting enhancement/bug fixes to the example.
Step 1: Parts/Folders
To start off, create the following folders, parts and scripts. Name them accordingly:

MonsterSpawns (Folder): to hold all our monster spawning location
Monsters (Folder): to hold all our monsters
MS (Part): the actual spawning location for one monster
We will also create a new Rig (a NPC body) as our enemy. Name the rig “Monster”:

Inside the Monster model, add one new Script:

and also, add one new “Vector3Value”, name it “SpawnPosition”:



Bring the Monster rig into “ServerStorage”:

Step 2: Scripts
game.ServerStorage.SpawnMonster

game.ServerScriptService.giveSpawnScript

game.ServerStorage.Monster.MonsterBehavior

game.ServerScriptService.testGiveDmg (for testing)



