This is my current script
if script.Parent.Humanoid.Health = 0 then
wait(3)
script.Parent.Humanoid.Health = 100 -- The max health
This is my current script
if script.Parent.Humanoid.Health = 0 then
wait(3)
script.Parent.Humanoid.Health = 100 -- The max health
Well, one way is to name every NPC differently so you might name it "Bob" or "Joe" if you have 2 NPC's with the same name then this won't work.
Have these steps:
Make sure you have 2 of the NPC
Have 1 in WorkSpace
Have 1 in ReplicatedStorage
Make sure you know where you want the NPC to spawn
Put this script in serverScriptService
local spawnLocation = game.Workspace:WaitForChild("NPCSpawn") --Where you want the NPC to spawn
while true do
wait()
if not game.Workspace.FindFirstChild("NPCNAME") then--Npc name here
local CloneNpc = game.ReplicatedStorage:WaitForChild("NPCName"):Clone()
CloneNpc.Parent = game.Workspace
CloneNpc.Position = Vector3.new(spawnLocation.Postion)
end
end
Make sure you name everything correctly if there is any errors or comment, comment on this answer. Otherwise, if it worked please accept answer ;)
DaHealth = 100 -- Change this to full health
DeHealth = 0
Hum = script.Parent.Humanoid.Health
Photon = true -- Hehe :)
while Photon == true then
if Hum == DeHealth then -- If the health is 0
wait(3)
Hum = DaHealth -- The Health will go to Full Health.
end)
I don't know if it will work.
I'm pretty sure you have to use the :MakeJoints() method if you are disjointing them....
lol, I didn't know about 'while true do' the time i asked this question
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Instead of doing while true do wait(), you can do while wait() do. It looks cleaner.