ProfileService Error

I am currently making it so when a Player steps out of the “zone” they gain time But for some reason when they die and respawn again the time seems to stop working and ProfileService gives me a error with the following.

I tried adding a check for when the Player respawns but I don’t think it worked or maybe I made it wrong…if anyone could help me would be much appreciated. Thank you!

Script

local Data = require(script.Parent.PlayerData)
local Players = game:GetService("Players")

local SafeZone = game.Workspace.LobbyFloor:WaitForChild("SafeZone")

local HalfSize = SafeZone.Size/2
local MinVector = SafeZone.Position - HalfSize
local MaxVector = SafeZone.Position + HalfSize

_G.SafeZone = Region3.new(MinVector, MaxVector)

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local Humanoid = character:WaitForChild("Humanoid")

		while wait(1) do
			if Humanoid.Health == 0 then break end
			if not player.Character then return end
			if not table.find(workspace:FindPartsInRegion3WithWhiteList(_G.SafeZone, {player.Character}), player.Character.HumanoidRootPart) then
				local profile = Data[player]
				profile.Data.TimeAlive = profile.Data.TimeAlive + 1

				local UpdateTime = player.leaderstats.TimeAlive
				UpdateTime.Value = profile.Data.TimeAlive
			end
		end
	end)
end)

What is the code of this module?

This is for ProfileService it’s the main leaderstats are stored
image