So i am trying to remove the respawn loops & make them functions when the humanoid dies. this is the scripts i have
Server script inside test NPC
local spawna = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("spawna"))
local hum = script.Parent.Undead
hum.Died:Connect(function()
spawna.Respawn(hum,script.Parent, 10) -- script.Parent is the Model
end)
Module script for this
local spawna = {}
spawna.Respawn = function(robot, clone, spawntime)
wait(spawntime)
clone.Parent = nil
wait(5)
robot:Destroy()
clone.Parent = game.Workspace.NPC
clone:MakeJoints()
end
return spawna
and this is the error, Please Help!
The Parent property of Dummy is locked, current parent: NULL, new parent NPC

2 comments
Line 5 in the module script can be removed. Setting the parent to nil is similar to the :Destroy() method, something which you don't want in this case.
Not the problem :(