Sup guys im having a problem with a script it is an respawning npc script it works but in the output it says an error.
.
my code is this
npc=script.Parent:clone()
local model = script.Parent
local humanoid = model.Humanoid
while true do
wait(1)
if humanoid.Health<1 then
Npc=npc:clone()
Npc.Parent=script.Parent.Parent
Npc:makeJoints()
script.Parent:remove()
end
end
You’re trying to :clone() a reference that is itself a :clone() and never has its parent set, so you’re potentially attempting to reference something the engines’ garbage collector has already cleaned up.
Try changing the reference npc=script.Parent:clone() to just npc = script.Parent and you’ll be able to properly clone it.
Is variable Npc declared somewhere? Try changing the clone line to: local Npc = npc:clone() so that the following lines have a proper variable to reference.