vlad909
(vlad909)
October 4, 2020, 2:57pm
#1
I’m trying to make an NPC respawn once killed.
When it respawns the NPCs’ scripts don’t work.
https://gyazo.com/99c38e07d91049d7e0246a2750b12a0a
I’ve looked at some posts but they don’t really help, I’ve also tried doing something along these lines:
NPC:WaitForChild("Script").Disabled = true
NPC:WaitForChild("Script").Disabled = false
Any help would be appreciated.
1 Like
To Respawn, I would suggest just destroying that NPC & cloning and placing a new one, from ServerStorage or something.
vlad909
(vlad909)
October 4, 2020, 3:00pm
#3
I’m already doing that, but all the scripts that allow the NPC to attack the humanoid just stop.
vlad909
(vlad909)
October 4, 2020, 3:03pm
#5
Do they have to be in ServerStorage? Or can I put them in ReplicatedStorage?
I usually use ServerStorage for storing Assets that are used by server mostly, and I believe you are cloning the NPC from Server Side? Also are there any errors or anything for debugging it & please post the scripts related to it, so we can debug more.
vlad909
(vlad909)
October 4, 2020, 3:08pm
#7
The stuff i crossed off isn’t relevant, these are the scripts.
Aeventy
(Aeventy)
October 4, 2020, 3:08pm
#8
Ah, I got it.
Clone the NPC, but don’t give it a parent.
local BackupNPC = NPC:Clone()
then
NPC.Died:connect(function()
BackupNPC.Parent = workspace
While you don’t assign a parent, the parent is nil , meaning that it won’t operate yet.
*NPC.Died - Well, find a way to determine when the first NPC is dead.
vlad909
(vlad909)
October 4, 2020, 3:10pm
#9
This is my current script, it basically does what you did there yet it doesn’t work.