of     1   

Kie_413
#178834318Sunday, November 29, 2015 2:50 PM GMT

I am having issues with this simple zombie respawn script. Does anyone know anyway of making it more efficient less laggy? Because I have so many npcs in a map, it causes lag spikes every 10 seconds. (As it has to run this script for each NPC). For the NPCs I have a model called NPCs then another model inside of it called NPCs with all the npcs inside of it. So far this script has to be placed into each individual npc. Could there also be a way to have the scirpt auto put it's self into an npc if it's humanoid.health < 1 ? thanks, script: name = "Humanoid" robo = script.Parent:clone() while wait(10) do if script.Parent.Humanoid.Health < 1 then wait(35) robot = robo:Clone() robot.Parent = script.Parent.Parent robot:MakeJoints() script.Parent:Remove() break end end
Kie_413
#178837219Sunday, November 29, 2015 3:44 PM GMT

Do you think this would be a better method? DefaultNPC = script.Parent:clone() script.Parent:WaitForChild("Humanoid").Died:connect(function() wait(30) local NewDefaultNPC = DefaultNPC:Clone() NewDefaultNPC.Parent = script.Parent.Parent NewDefaultNPC:MakeJoints() script.Parent:Remove() end)
Eyerny
#178837605Sunday, November 29, 2015 3:51 PM GMT

Instead keep the zombie in the Serverstorage. NPC = game.ServerStorage.NPCName script.Parent:WaitForChild("Humanoid").Died:connect(function() wait(30) local NewDefaultNPC = NPC:Clone() NewDefaultNPC.Parent = workspace script.Parent:remove() end)
Kie_413
#178840289Sunday, November 29, 2015 4:33 PM GMT

When I use Serverstorage some reason the NPC dies on respawn.
Kie_413
#178908140Monday, November 30, 2015 4:40 PM GMT

bump

    of     1