Why does this script make my studio freeze when I playtest?

Whenever I try to playtest my studio just freezes (same thing if I just run), I figured out that it’s coming from this script:

--[[
	7/30/20

	This is the script that makes the ufo comes in and drop aliens.

]]

-- // Services \\ --

local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")

-- // Modules \\ --

local Core = require(ReplicatedStorage.Modules.Core)
local Data = require(ServerScriptService.Data)

-- // Variables \\ --

-- Settings
local Planet = "Earth"
local Biome = "Grass"

-- Tweenserv
local Info = TweenInfo.new(2, Enum.EasingStyle.Linear)

-- References 
local Positions = workspace.MobUfoPositions[Planet][Biome]
local Enemies = ServerStorage.Objects.Mobs[Planet][Biome]
local ActiveEnemies = Workspace.Objects.Mobs[Planet][Biome]

-- Counters
local Debounce = false
local OnMap = false
local Deaths = 0
local Dropping = false

-- // Functions \\ --
function GetEnemies()
	local v = 0
	
	for _, Enemy in pairs(ActiveEnemies:GetChildren()) do
		if Enemy.Humanoid.Health > 0 then
			v += 1
		end
	end
	
	return v
end

function GetPlayersOnPlanet()
	local v = 0
	
	for _, Player in pairs(Players:GetChildren()) do
		if Data.Get(Player, "CurrentPlanet") == "Earth" then
			v += 1
		end
	end
	
	return v
end

function SpawnEnemies( ChosenEnemy)
	local ChosenEnemy = Core.CloneInstance(ChosenEnemy, {Parent = ActiveEnemies})
	ChosenEnemy:SetPrimaryPartCFrame(script.Parent.Parent.DropPosition.CFrame)

	ChosenEnemy.Humanoid.Died:Connect(function()
		Deaths += 1
		
		if Deaths >= 10 then
			Deaths = 0
			
			Tween(Positions.Appearing)
			Tween(Positions.DroppingPoint)
			
			local RandomEnemy = Enemies:GetChildren()[math.random(1, #Enemies:GetChildren())]
			
			for i = 1, GetPlayersOnPlanet()*10 do
				if GetEnemies() > GetPlayersOnPlanet()*20 then
					break
				end	
				
				wait(0.5)
				SpawnEnemies(RandomEnemy)
			end
			
			script.Parent.Parent:MoveTo(Positions.Starting.Position)					
		end		
	end)

end

function Tween(d)
	TweenService:Create(script.Parent, Info, {CFrame = CFrame.new(d.Position)}):Play()
	wait(2)
end

--[[function MoveRandomPos()
	local Axis = Positions.Corners
	
	local RandomX = math.random(Axis.LeastX.Position.X, Axis.MostX.Position.X)
	local RandomZ = math.random(Axis.LeastZ.Position.Z, Axis.MostZ.Position.Z)
	local Y = Axis.Y.Position.Y
	
	TweenService:Create(script.Parent, Info, {CFrame = CFrame.new(RandomX, Y, RandomZ)}):Play()
	wait(2)	
end]]

function StartMob()
		
	Debounce = true
	Deaths = 0
	
	Tween(Positions.Appearing)
	Tween(Positions.DroppingPoint)	
	
	local RandomEnemy = Enemies:GetChildren()[math.random(1, #Enemies:GetChildren())]
	
	for i = 1, 15 do 
		wait(0.5)
		SpawnEnemies(RandomEnemy)
	end
	
	script.Parent.Parent:MoveTo(Positions.Starting.Position)
	
end

-- // Setup \\ --
StartMob()

(Core is a module that has useful functions to optomize my script more, the error isn’t coming from it).

Because when I comment the whole thing out it stops crashing. It could be that this script is spamming an error really fast and that crashes the studio, not sure. If someone can spot the problem please let me know asap.

Nevermind, I found the problem. It was completely unrelated.