Spawning problem 2

PROBLEM: There’s a script I’m making, the point of this certain series of codes is to spawn the ‘Shade’ entity from the part (MainTruss) specified within the script; The enemy is spawning in pieces, and the enemy is only spawning once instead of the intended 11.
INFO: The thing is, the enemy’s spawning is triggered when another script in the model fires an event(Bindable) upon exploding. The explosion scatteres it’s body parts so I delayed the spawn, if there’s any way you can help me to make it so the enemy isn’t torn to pieces upon the explosion.

CODE:

 local bind = game.ReplicatedStorage.Upon_Being_Broken
 local limit = 11 
 local shade = game.ServerStorage.Shade 
 local SP = script.Parent
 local DB = false
 bind.Event:Connect(function()
 if DB then return end
         local enemy = shade:Clone() 
         local humanoid = enemy.Humanoid 
         enemy.Torso.CFrame = SP.CFrame 
         wait(30)
         for i = 1, limit do 
         enemy.Parent = workspace 
      end 
     DB = true
 end)
1 Like

When you are doing the loop, your enemy is being cloned outside of the loop, resulting in spawning only once. The line that clones the enemy should be inside the loop.

Thanks, that part’s tied up nicely, I don’t think I need help for the unanchoring bit, kinda unnecessary for what I’m going for, sorry for the trouble.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.