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
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