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

Help Me On This Script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I'm making a Alien that when you kill it, it spawns aliens. But the aliens that spawn don't teleport to the Alien that died any help???

TorsoPos = script.Parent.Torso.Position
SpizerMob = game.Lighting.Spizer
SpizerCount = math.random(1,4)

function SpizerSpawn()
    SpizerMob:clone().Parent = workspace
    wait(1)
    SpizerMob.Torso.Position = Vector3.new(TorsoPos)
end

while wait(1) do
if script.Parent.Alien.Health < 1 then


if SpizerCount == 1 then
    SpizerSpawn()
elseif SpizerCount == 2 then
    SpizerSpawn()
    SpizerSpawn()
elseif SpizerCount == 3 then
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
elseif SpizerCount == 4 then
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
    wait(1)
end
end
end

1 answer

Log in to vote
0
Answered by
Discern 1007 Moderation Voter
9 years ago

On line 1, you're attempting to set the bariable to its position. Actually what you're doing is setting the actual Vector3 value. Your variable should be script.Parent.Torso, and go to TorsoPos.Position every time in the script. Check this out:

TorsoPos = script.Parent.Torso
SpizerMob = game.Lighting.Spizer
SpizerCount = math.random(1,4)

function SpizerSpawn()
    SpizerMob:clone().Parent = workspace
    wait(1)
    SpizerMob.Torso.Position = TorsoPos.Position
end

while wait(1) do
if script.Parent.Alien.Health < 1 then


if SpizerCount == 1 then
    SpizerSpawn()
elseif SpizerCount == 2 then
    SpizerSpawn()
    SpizerSpawn()
elseif SpizerCount == 3 then
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
elseif SpizerCount == 4 then
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
    SpizerSpawn()
end
end
     wait(1) --Also moved the wait down to make the wait apply every time the loop runs.
end
0
It works but there is one problem the "Spizer" dies when it gets spawned and the first "Spizer" that spawns spawns in a random place :/ Anthony9960 210 — 9y
Ad

Answer this question