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

How do I Regenerate a Killed Humanoid Noob?

Asked by
SirPaco 66
9 years ago

I created a Humanoid Noob by the name of "Noob" and when it is killed my Script I attempted to create will not respawn it.

Here is the Script that I attempted to create but it does not work.

local copy = Noob:clone(1)

wait (15)

Noob.Humanoid.Died:connect(function () copy.Parent = game.Workspace end

1 answer

Log in to vote
1
Answered by 9 years ago
local NPC = script.Parent -- You are missing this. The game needs to know where "Noob" is.
local NPC2 = NPC:Clone() -- Cloning the NPC.

NPC.Humanoid.Died:connect(function() -- Created the function that we will use to get information when dead.
NPC2.Parent =  game.Workspace -- Changing the NPC clone's parent from **nil** to **workspace**. 
wait(0.5)
NPC:remove() -- Removing the remains of the dead NPC.

end) -- And ending it off with an end for our function above.


A Humanoid.Died function can tell if the player has died or not, by doing this you can do many things like kicking them from the game, respawning, giving an award, taking away leaderstats, and much more...

I see in yours that you tried the same function..

One more thing, there's an output in studio, it helps debug scripts. To access it, simply go to the view tab and click on output.

Change the script how you like it, and remember, enjoy!

I hope you learned something.

0
Thank you it works. But I need there to be a 15 seconds timer for the Regeneration. I edited wait (0.5) to wait (15) but it did nothing. SirPaco 66 — 9y
Ad

Answer this question