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

How do I spawn NPCs and have them not spawn with zero health?

Asked by 6 years ago
Edited 6 years ago

Hey friends,

Im working on spawning NPCs with a humanoid into my game, but unfortunately, they spawn with zero health and die instantaneously.

How would I fix that? Thanks!

Here's the script I use to spawn

I was trying to work with :MakeJoints(), but I did not understand it completely.

local Blob = game.ServerStorage.MiniEnemies.Blob:Clone()
Blob:Clone()
Blob:MakeJoints()
Blob.Parent = game.Workspace
Blob:MakeJoints()
Blob.Humanoid.Health = 500

And I also have this

            local boss = game.ServerStorage.ComputerVirus:Clone()
            boss:Clone()
            boss:MakeJoints()
            boss.Humanoid.Health = 10000000
            boss.Attacks.Disabled = false
            boss.Humanoid.HumanoidS.Disabled = false
            boss.Parent = game.Workspace
            boss:MakeJoints()

Help appreciated!

0
its probably has zero health from the start. Developer_Kai 11 — 6y
0
boss.Humanoid.Health = 10000000 QuantumWaffle 17 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago

There's several things you could try:

1st) Make their health infinite in the ServerStorage and once you clone them change their Health and MaxHealth to wanted amount, add a wait() and then clone them into the Workspace.

2nd) Give them a ForceField in ServerStorage, and disable all scripts when they spawn in, and after a wait() function enable them.

3rd) Make a re-spawn script that re-spawns the entity after they're cloned into Workspace. Assuming you don't want them to re-spawn after the player kills them, delete that script after it's served it's purpose

These are just some of the solutions I could think of. Not 100% sure if they will work but it's worth a shot. If you gave me more detail about the entities themselves I would gladly help you out.

0
You could could also just change the NPC's health to 100 when they spawn. 0HappyManDudeguy0 15 — 6y
0
None of these solutions would work. CootKitty 311 — 6y
Ad

Answer this question