local infamount = script.Parent.Parent.NpcFolder.Values.InfantryCount.Value
for i = 1, infamount do
wait(1)
if infamount <= 0 then
print("broke loop")
break
end
if infamount >= 1 then
print("spawning troop")
local point = script.Parent.Parent.Parent.DropSpawn local offset = Vector3.new(0,-4,0) local copy = game.ServerStorage.Npcs.Infantry:Clone() copy.Parent = game.Workspace copy:SetPrimaryPartCFrame(point.CFrame + offset) copy.MasterFolder.EnableAll.Disabled = false infamount.Value = infamount.Value - 1 end end
Im trying to get this loop to spawn some npcs. infamount.Value is the number of times the for loop should spawn the npcs. but instead of throwing an error it just doesnt even run past the first line. I think but im not sure I might have the for loop set up wrong but correct me if Im wrong.