local MAX_MINION = 3
function getSpawns()
local c = game.Workspace.BlueMinionSpawns:GetChildren()
local spawns = {}
for index, child in pairs(c) do
if child.Name == "BlueMinionSpawn" then
table.insert(spawns, child)
end
end
return spawns
end
function pickRandomChild(tab)
return tab[math.random(1, #tab)]
end
function spawnMinion()
local blueciviliancollection = game.Lighting.Troops.Blue.BlueCivilians:GetChildren()
local spawns = getSpawns()
local minion = pickRandomChild(blueciviliancollection):clone()
local spawn = pickRandomChild(spawns)
minion.Parent = game.Workspace
minion:MakeJoints()
minion:MoveTo(spawn.Position)
end
function minionCount()
local minions = {}
local c = game.Workspace:GetChildren()
for index, child in pairs(c) do
if child.Name == "BlueCivilian" or child.Name == "BlueGirlCivilian" then
table.insert(minions, child)
end
end
return #minions
end
while true do
if minionCount() < MAX_MINION then
if math.random(1, 2) == 1 then
spawnMinion()
end
end
wait(5)
end
I've been having disconnection problems ever since I've been working on my game Civilization Domination So I've been narrowing it down from the problem. I removed a couple of scripts, and tested for a hour each for each particular one. So then I found that when I removed a script that connected to multiple, it stopped disconnecting, so I narrowed it down to Troops, Spawning, or the Masterscript.
The Masterscript simply just loads buildings and messages onto the game, and I've been using the same one for quite a while.
The troops are relatively basic models that I've been working with for a good amount of time.
The spawning was a relatively new one.. I don't see anything wrong with it, but I find that if I removed it, the game would simply stop disconnecting(Though that carries back to whether the troops are the problem or not, but I've tested it with 30 troops all in the same time.)
Does anyone have any ideas?

1 comment
Is it a 'You have disconnect from the game' or a crash?