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

What's wrong with my script?

Asked by 9 years ago

I'm trying to get a zombie spawning script but when it spawns, it dies automatically.


waittime = 60 -- 1 min function StartCountdown() waittime = 60 -- Reset the waittime everytime you start a countdown for i =1,60 do -- for 1, 60 times do -- This can be done differently, i.e repeat -code- until waittime = waittime - 1 -- Minus 1 every second wait(1) end SpawnZombie() -- Spawn a zombie after the for loop is finished StartCountdown() -- In Another min another zombie will be spawned end function SpawnZombie() local Zombie = game.Lighting.Zombie:Clone() -- Assuming its in the lighting and its name is Zombie Zombie.Parent = game.Workspace -- You can place the zombie in an appropriate spot and just parent them to workspace when spawning(Easiest way) for i,v in pairs(Zombie:GetChildren()) do -- This gets the scripts in the zombie and enables them(Keep the scripts in the Zombie Disabled so they dont brake while in the lighting) if v:IsA("Script") then v.Disabled = false end end end StartCountdown() -- Run the function to start the game/round

1 answer

Log in to vote
0
Answered by
Defaultio 160
9 years ago

Looks like you didn't get all of your code in a code block, that would help. But I suspect that your zombies may be dying because you aren't calling :MakeJoints() on the zombie to make sure it's all held together.

Add in: Zombie:MakeJoints()

Right after the line where you parent Zombie to Workspace.

0
What if it's in lightning? Just do the same thing? FancyFame 15 — 9y
0
Nevermind, going to put it in workspace again FancyFame 15 — 9y
0
Also,what if the script makes it spawn multiple times? FancyFame 15 — 9y
0
Yes, it's fine if you keep the zombie backup Lighting. Just add that line right after the Zombie.Parent = game.Workspace line. Hope this helps! Defaultio 160 — 9y
View all comments (4 more)
0
So It's supposed to look like Zombie.Parent = game.Workspace -- You can place the zombie in an appropriate spot and just parent them to workspace when spawning(Easiest way) FancyFame 15 — 9y
0
Linebreak then put Zombie:MakeJoints()? FancyFame 15 — 9y
0
Sorry if this bugs you or not, but How do I move the spawn location up a little? Because It's working and all but It spawns stuck in the ground. FancyFame 15 — 9y
0
As it is, it's not changing the zombie's position at all. It will simply move a copy from lighting to Workspace. To change that position, pu t the zombie in workspace where you want it to spawn, then put it back in lighting. You can do this by cutting, Cntrl+X, and then right clicking lighting and using "Paste into". Defaultio 160 — 9y
Ad

Answer this question