I Want To Make A Time Freeze Mechanic But I Keep Getting This Error Saying

Workspace.nathanjohns123.ZAWURUDO:60: attempt to index nil with 'Parent' Can You Either Tell Me how to print A Directory eg: Instead Of Printing "Part" It Prints "game.Workspace.Part" or Tell Me how To Fix It? (if you want to test it put the script in the startercharacterscripts) Here's My Time Freeze Code The Error Is happening At the function loop2()

T = 1
Frame = 10
children = game.Workspace:GetChildren()
Wow = false
Time = true
Break = false
WaveSpeed = game.Workspace.Terrain.WaterWaveSpeed
RespawnTime = game.Players.RespawnTime
TimeC = Time
function loop1(Child)
	for i = 1, #Child do
		local Children = Child[i]:GetChildren()
		local Parent = Child[i]
		local Issues = {}
		while true do
			if Parent == game.Workspace then
				break
			end
			
			Parent = Parent.Parent
			table.insert(Issues,Parent)
		end
		local Ignore = false
		for i = 1,#Issues do
			if Issues[i] == script.Parent then
				Ignore = true
				break
			end
		end
		if Child[i].ClassName == "Script" or Child[i].ClassName == "LocalScript" then
			if Ignore == false then
				local IN = Instance.new("BoolValue")
				IN.Parent = Child[i]
				IN.Name = "DisabledV"
				IN.Value = Child[i].Disabled
				Child[i].Disabled = true
			end
		end
		if Child[i].ClassName == "Part" or Child[i].ClassName == "MeshPart" then
			if Ignore == false then
				local IN = Instance.new("BoolValue")
				IN.Parent = Child[i]
				IN.Name = "AnchoredV"
				IN.Value = Child[i].Anchored
				Child[i].Anchored = true
			end
		end
		loop1(Children)
	end
end
function loop2(Child)
	for i = 1, #Child do
		local Children = Child[i]:GetChildren()
		local Parenta = Child[i]
		local Issues = {}
		while true do
			if Parenta == game.Workspace then
				break
			end
			Parenta = Parenta.Parent
			table.insert(Issues,Parenta)
		end
		local Ignore = false
		for i = 1,#Issues do
			if Issues[i] == script.Parent then
				print(Issues[i])
				Ignore = true
				break
			end
		end
		if Child[i].ClassName == "Part" or Child[i].ClassName == "MeshPart" then
			if Ignore == false then
				Child[i].Anchored = Child[i].AnchoredV.Value
				Child[i].AnchoredV:Destroy()
			end
		end
		if Child[i].ClassName == "Script" or Child[i].ClassName == "LocalScript" then
			if Child[i].Name ~= "FOV Change" then
				if Ignore == false then
					Child[i].Disabled = Child[i].DisabledV.Value
					Child[i].DisabledV:Destroy()
				end
			end
		end
		loop2(Children)
	end
end
Players = game.Players:GetChildren()
function Stuff()
	while wait() do
		if T == 1 then
			if Time == true and TimeC == Time then
				loop1(children)
				print("ay")
				game.Workspace.Terrain.WaterWaveSpeed = 0
				game.Players.RespawnTime = 99999999999
				Time = false
			end
			if Time == false and TimeC == Time then
				loop2(children)
				game.Players.RespawnTime = RespawnTime
				game.Workspace.Terrain.WaterWaveSpeed = WaveSpeed
				Time = true
			end
		end
		game.Lighting.ColorCorrection.Contrast -= 0.05
		if game.Lighting.ColorCorrection.Contrast <= -2 then
			Frame = 10
			while wait() do
				if Wow == false then
					game.Lighting.ColorCorrection.Contrast += 0.2
					if game.Lighting.ColorCorrection.Contrast > 0 then
						game.Lighting.ColorCorrection.Contrast = 0
						script.Trans.Value = false
						Break = true
						break
					end
				end
			end
		end
		T = T + 0.025
		if Break == true then
			Break = false
			TimeC = Time
			T = 1
			break
		end
	end
end

script.Trans.Changed:Connect(function()
	if script.Trans.Value == true then
		game.Workspace.TF.Playing = true
		Stuff()
	end
end)

(Yes It Is Long) Anyways Can You Help Me With This?

1 comment

0

Acually I Fixed It