How do I place an NPC in replicated storage for 25 seconds and then place it back in the workspace when it is dead??
[npc].Parent = game.ReplicatedStorage
task.wait(25)
[npc].Parent = workspace
?
i tried that but it wont work.
Won’t work in which way?
Your posts need to have more details in order to ensure that they are answerable…
that`s the entire code i wrote
i will find another way around the code instead of the wait and parenting
maybe put something like
local npc = [put npc here]
local event =[put event here]
wait()
npc.Parent = ReplicatedStorage
task.wait(25)
event:FireAllServers()
different script
local event = [put event here]
local NPC = [put npc here]
event.OnClientEvent:Connect(function()
npc.parent = workspace
end
it may seem overkill and there may seem like too much code but its more efficient and makes it have less of a chance of malfunctioning
i hope it helps.
local npc = --npc location here
npc.Parent = game.ReplicatedStorage
wait(25)
npc:WaitForChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(function()
if npc.Humanoid.Health == 0 then
npc.Parent = workspace
end)
Should work i havent tested