How do I create a Regeneration Script for a Model? I would this function to execute after a Button with a ClickDetector has been Clicked.
Humanoid Regeneration Script:
local NPC = script.Parent local NPC2 = NPC:Clone() NPC.Humanoid.Died:connect(function() script.Parent = workspace wait(5) NPC:Destroy() wait(10) NPC2:Clone().Parent = game.Workspace script:Destroy() end)
local NPC = script.Parent local NPC2 = NPC:Clone() NPC.Humanoid.Died:connect(function() NPC.Parent = game.Workspace --The problem is here. You made a variable called "NPC" which mean "script.Parent" so then you would need to make the "script.Parent" you have on this line of code to be "NPC" then add ".Parent" to parent it to workspace. wait(5) NPC:Destroy() wait(10) NPC2:Clone().Parent = game.Workspace --Good job over here. script:Destroy() end)