Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my NPC die after being moved from ReplicatedStorage to Workspace?

So I have a spawning mechanism that copies an NPC from ReplicatedStorage to the Workspace. It works, but the problem is that upon being moved, it instantly dies. How do I prevent this from happening?

Image of what happens AFTER it is moved

Code of the spawning:

local zambieBox = game.ReplicatedStorage.Zombies
local zambie = zambieBox.grassPl0X
local spawner = game.Workspace.grassSpawner
local spawnPos = spawner.Position
local roundStart = spawner.roundStatus
local zambieCount = spawner.zambieCount
local currentRound = spawner.currentRound

function spawn()
	newZambie = zambie:Clone()
	newZambie.Parent = game.Workspace
	newZambie.Torso.Position = spawnPos
	newZambie.Humanoid.Health = 100
	zambieCount.Value = zambieCount.Value + 1
end

while roundStatus and zambieCount < 5*currentRound.Value do
	wait(4)
	spawn()
end

5 comments

3

newZambie:MakeJoints()

0

Do I put that inside the spawn() function?

0

Ya.

1

Thanks!

0

No problem.

1 answer

Like TheAlphaStigma said, just add:

newZambie:MakeJoints()

To your spawn function.

This discussion is preserved as it was. New answers, comments, and votes are closed.