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

Zombie Wave Cloning Script Issue?

So I have a script in workspace that will clone zombies to a certain point in wave increments (every wave spawns more zombies) the problem is when I tested this as soon as the zombies teleport they die, is there any suggestions on how to fix this. I use MoveTo:() for teleporting the zombies and then I teleport their model. If you have any suggestions please tell me. Here is the code: (random map basically picks a randomap to spawn which is done above this, it is not important but when teleporting them they must teleport to [randommap].ZombieSpawn1)

The variable zombie found in local zombieclone = zombie:clone() is game.Lighting.Zombie

repeat wait(10)
	local wavenum = script.Wave
	wavenum.Value = wavenum.Value +1
	topgui.Value = "Wave " ..wavenum.Value.. "!"
	local zoms = math.random(5,10)
	local zomsfinal = zoms*wavenum.Value
	for spawn1 = 0, zomsfinal do
		local zombieclone = zombie:clone()
		zombieclone.Parent = game.Workspace[randommap]
		zombieclone:MoveTo(game.Workspace[randommap].ZombieSpawn1.Position)
		print("zombiespawn1 spawned")
		wait(2)
	end
until gameover.Value == true

1 comment

0

Post where randommap is defined.

1 answer

You need to use the MakeJoints method to well, make its joints! When cloning a model that contains parts within it, you need to bond all of its joints back together!

repeat wait(10)
    local wavenum = script.Wave
    wavenum.Value = wavenum.Value +1
    topgui.Value = "Wave " ..wavenum.Value.. "!"
    local zoms = math.random(5,10)
    local zomsfinal = zoms*wavenum.Value
    for spawn1 = 0, zomsfinal do
        local zombieclone = zombie:clone()
	zombieclone:MakeJoints()
        zombieclone.Parent = game.Workspace[randommap]
        zombieclone:MoveTo(game.Workspace[randommap].ZombieSpawn1.Position)
        print("zombiespawn1 spawned")
        wait(2)
    end
until gameover.Value == true

4 comments

0

This almost works. It looks like all the joints are "joined" except for the head. Whenever it clones the head goes flying off the body while everything else stays together, any advice?

0

normal humanoid objects have special snaps made, not dj

0

Normal humanoid objects get special snaps made for all their joints. MakeJoints only make joints represented by the surfaces of parts. Make sure the bottom of the head has a compatible surface to join to the top of the torso and that they are in contact

0

All parts appear to have the proper surfaces...

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