✓ Accepted answer
Hello.
If you have a monster/enemy already created. That's fine. For this answer I will use the Drooling Zombie free model as an example. You can use the following code as well, but update the definitions as needed. First, create a Script in ServerScriptService. Add the enemy model inside ServerStorage. If you have an invisible BasePart you want to use, leave it just where it is. If you have a model for the spawner, make all Parts able to collide, and choose a Part where you want the enemy to spawn. Now start editing the Script. We must first define our variables. In this case that would be the spawn brick, and the enemy. I will use the Drooling Zombie and the spawn brick will be "Spawn".
local enemy = game.ServerStorage["Drooling Zombie"]
local spawn = game.Workspace.Spawn
Now that we have our variables, we will start to create our function to spawn the enemy. I will make a while loop to spawn a zombie every 15 seconds.
while true do
local c = enemy:Clone()
c.Parent = game.Workspace
c:MoveTo(spawn.Position)
wait(15)
end
That's all there is to it! In simpler words, we copy an enemy model, parent it to the Workspace, and move it. I hope this helps!
1 comment
thats wut i wanted lel