local g=false local V=script repeat wait(0)until script and(script.Parent and script.Parent.ClassName=="\077\111\100\101\108")local S=V.Parent local I=game:GetService("\068\101\098\114\105\115")local J for g,V in pairs(S:GetChildren())do if V and(V.ClassName=="\072\117\109\097\110\111\105\100"and V.Health~=0)then J=V end end local R=S:Clone()if g then coroutine.resume(coroutine.create(function()if S and(J and(J:FindFirstChild("\083\116\097\116\117\115")and not(J:FindFirstChild("\083\116\097\116\117\115")):FindFirstChild("\065\118\097\108\105\098\108\101\083\112\097\119\110\115")))then SpawnModel=Instance.new("\077\111\100\101\108")SpawnModel.Parent=J.Status SpawnModel.Name="\065\118\097\108\105\098\108\101\083\112\097\119\110\115"else SpawnModel=(J:FindFirstChild("\083\116\097\116\117\115")):FindFirstChild("\065\118\097\108\105\098\108\101\083\112\097\119\110\115")end function FindSpawn(g)local V=g:GetChildren()for g=1,#V,1 do if V[g].className=="\083\112\097\119\110\076\111\099\097\116\105\111\110"then local S=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101",SpawnModel)S.Value=V[g].Position S.Name=V[g].Duration end FindSpawn(V[g])end end FindSpawn(game:GetService("\087\111\114\107\115\112\097\099\101"))local g=SpawnModel:GetChildren()if#g>0 then local V=g[math.random(1,#g)]local J=Instance.new("\070\111\114\099\101\070\105\101\108\100")J.Parent=S J.Name="\083\112\097\119\110\070\111\114\099\101\070\105\101\108\100"I:AddItem(J,V.Name)S:MoveTo(V.Value+Vector3.new(0,3.5,0))else if S:FindFirstChild("\083\112\097\119\110\070\111\114\099\101\070\105\101\108\100")then(S:FindFirstChild("\083\112\097\119\110\070\111\114\099\101\070\105\101\108\100")):Destroy()end S:MoveTo(Vector3.new(0,115,0))end end))end function Respawn()wait(10)R.Parent=S.Parent R:makeJoints();(R:FindFirstChild("\072\101\097\100")):MakeJoints();(R:FindFirstChild("\084\111\114\115\111")):MakeJoints()S:remove()end if V and(S and J)then J.Died:Connect(Respawn)end
--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local JeffTheKiller=AdvancedRespawnScript.Parent;
local GameDerbis=game:GetService("Debris");
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local Respawndant=JeffTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid:FindFirstChild("Status")and not JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JeffTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JeffTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JeffTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JeffTheKiller:FindFirstChild("SpawnForceField")then
JeffTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JeffTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
wait(10);
Respawndant.Parent=JeffTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JeffTheKiller:remove();
end;
if AdvancedRespawnScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.Died:Connect(Respawn);
end;