Script Addition Help

Ok add this code under the new code i told you to add:

AlienClone.Torso.Anchored = true

run the game then tell me if you see aliens


They all spawned underground…

ok remove the anchor code then you know the middle 0 i told you before? yeah change it to 100 and lets see what happens

make a region3 and get a random Z and X position

It looks like @takticiadam is helping you with your first problem, so I’ll present you a solution for your second one. Once the aliens spawn, you could assign them StringValue called “Team”. Then, in the text for it you would type the Team’s name. After that you should check to see if the Team.Value is the same as the Aliens value.

I found them, I think I need to update the number again

Then enter a bigger number. repeat increasing the middle 0 until you see aliens

edit: yeah it looks like you did that i saw your edit, if you still have problems aliens not spawning then increase that number because your terrain has different heights at different locations

1 Like

How would I do this exactly???

What you want to do is every time you spawn an Alien, you’ll want to create a new StringValue. You can name this StringValue whatever you want. In the Value of it, type the Team’s name. After that, create a variable that stores the Alien’s team value (myTeam = Alien.Team.Value). Use an if statement to check whether or not the target that the alien has found has the same team value as the alien. If it does, then you can attack, but if not, the alien should find a new target.

Make the middle 0 bigger, I mean just increase the value of it

AlienClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(math.random(200,5000), 0, math.random(200, 5000))))

AlienClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(math.random(200,5000), 0, math.random(200, 5000))))

the bold one make it really big

I did not include the part where you check to see if the target that the Alien has latched onto is on another team. That part should be closer to your attack part (Wherever your code for finding a target is)

local SpawnedAliens = {}
local AlreadySpawned = false
while true do
	if (game.Lighting.ClockTime < 5 or game.Lighting.ClockTime > 18) and not AlreadySpawned then
		AlreadySpawned = true
		for i = 1, AlienAmount do
			local AlienClone = Alien:Clone()
			AlienClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(math.random(50,500), 0, math.random(50, 500))))
			AlienClone.Parent = workspace
            local [VariableName] = Instance.new("StringValue")
            [VariableName].Name = "Team"
            [VariableName].Value = [TeamValue]
            [VariableName].Parent = AlienClone
			table.insert(SpawnedAliens, AlienClone)
			wait(0.25)
		end
	elseif not (game.Lighting.ClockTime < 5 or game.Lighting.ClockTime > 18) and AlreadySpawned == true then
		if #SpawnedAliens > 0 then
			for i,v in pairs(SpawnedAliens) do
				if v ~= nil then
					v:Destroy()
				end
			end
		end
		AlreadySpawned = false
	end
	wait(1)
1 Like

where does the Variable go???

You should create the variable right after you parent the Alien to the workspace. Check to see if the Alien’s team.Value is/is not equal to the target that it latched onto.

Sorry, you’re also gonna want to parent the String to the Alien.

AlienClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(math.random(200,1000), 100, math.random(200, 1000))))

It looks perfect to me, just stop sending me screenshot every time you change the number, just keep increasing the value until you get what you want

1 Like

The number is not changing the spawn point

The middle one changes the height of where they spawn others are spawn points, if you did it correctly aliens will spawn at sky then drop to the ground and thats what you want