Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am trying to respawn NPC, but it only works once and second time it only dies?

Asked by 2 years ago
local RS = game:GetService("ReplicatedStorage")

script.Parent:WaitForChild("Faceling").Humanoid.Died:Connect(function()
    script.Parent.Faceling:Destroy() --Despawns the NPC model
    local Entity = RS.Entities.Faceling:Clone()
    Entity.Parent = script.Parent
    Entity:MoveTo(script.Parent.Position)

end)

Basically this checks if NPC dies and then clones new one from ReplicatedStorage, but for some reason this only works once and does not respawn after killing second time.

Would be glad if someone helps me out :), also I do not necessarily need fix and won't mind if someone gives me better way to respawn NPC to that location

0
In title I meant second time it falls apart after dying and stays like that. Sabailuridze 126 — 2y
0
maybe try "while true do" it creates a loop so maybe it'll work 123marooxd123 13 — 2y
0
Solved, Thank you Sabailuridze 126 — 2y

Answer this question