[UNSOLVED] Touch Comprehension Function with Countdown Timer

1: When the Player touches the certified Part a 15 Second(s) Countdown appears and when the Countdown reaches its limit it kills the Player. Mention, if the Player leaves the Part the Countdown doesn’t continue and actually (Stops).

2: An example given –

Here’s the really bad script –

local Time = 15
local AverageTime = 0
local LowerTime = -1

workspace.Part.Touched:Connect(function(Touch1)
	if Touch1.Parent:FindFirstChild("Humanoid") then
		local Player = game:GetService("Players"):GetPlayerFromCharacter(Touch1.Parent)
		local Character = Player.Character or Player.CharacterAdded:Wait()
		if Player then
				for _, Player in game:GetService("Players"):GetPlayers() do
					if Player:FindFirstChildOfClass("PlayerGui") then 
						local SafeZone = Player:FindFirstChild("PlayerGui"):FindFirstChild("SafeZoneGui"):FindFirstChild("CountDownText")
						SafeZone.Visible = false
						task.wait(0.5)
						SafeZone.Visible = true 
					for i = 1, 0, -1 do
							SafeZone.TextTransparency = i
							task.wait(0.05)
					end
					for i = Time, AverageTime, LowerTime do -- Countdown (15 Seconds)
						SafeZone.Text = i
						task.wait (1)
					end
						SafeZone.Text = ""

					if LowerTime then
							Character.Humanoid.Health = 0
				       workspace.Part.TouchEnded:Connect(function(Touch2)
					if Touch1 == Touch2 then
						-- Hide the TextLabel and Disable the Gui
						-- Fade Out
					end
				end)
			        end
		        end
	        end
		end
	end
end)