Error saving Humanoid data with ProfileService

Well, I managed to save some properties of the Humanoid (Health and MaxHealth) with ProfileService, these work correctly if you only lose life (when you die it gives you the problem) and then you exit the game and later enter the game, they will load well the data with the ProfileService. However, when you die and reappear, in health you should put the MaxHealth (this so that when you die, health is restored to how you have it in MaxHealth, in case you made changes to the health limit) but it does not, which does is give 0 in the health

local Players = game:GetService("Players") 
local ProfileService = require(script:WaitForChild("ProfileService"))
local saveStructure = {
	Other_objects_and_tools = {
		Backpack_tools = {	
			ToolsWithStacks = {};
			ToolsWithoutStacks = {};
			Ingredients_in_backpack = {};
		};
		Ingredients_or_objects_tools = {
			Ingredients_tools = {};
		};
	};

	PlayerServices = {
		Money = 2;
		LogInGiift = 0;
		Level_and_XP_or_other = {
			Level = 1;
			XP = 0;
		};
		CharacterServices = {
			Hunger_Services = {
				Hunger = 100;
				Max_Hunger = 100;
			};
			Thirst_Services = {
				Thirst = 100;
				Max_Thirst = 100;
			};
			Set_Health = {
				MaxHealth = 100;
				Health = 100;
			}
		};
	};
	Game_Configurations = {
		Graphics = {
			Shadows = "Medio";
			Water = "Medio";
			Tree = "Enabled";
		};
		General = {	
			FPS = "Disable";
			Ping = "Disable";
			BrilloVol = 0.7;
			PlayerChose = "ForLocalPlayer";
			Language = "English";
			SlotsInventory = 90;
		};
		Controls_and_keys ={
			Controls = {
				Crouch = "Keep";
				Sprint = "Keep";
				Sensitivity = 0.5;
			};
			KeyCodes = {
				Open_and_close_map = "M";
				Drop_objects = "E";
				Interactions = "F";
				Sprint_key = "LeftShift";
				Crouch_key = "LeftControl";
				Slots = {
					Slot_One = "One";
					Slot_Two = "Two";
					Slot_Three = "Three";
					Slot_Four = "Four";
					Slot_Five = "Five";
				}
			}
		}};
}

local PlayerProfileStore = ProfileService.GetProfileStore("test67", saveStructure)

local cachedProfiles = {}

local function DoSomethingWithALoadedProfile(player, profile)
	local GiftMoney = math.random(920, 1590)
	profile.Data.LogInGiift = profile.Data.PlayerServices.LogInGiift + 1
	print(player.Name, "has logged in " .. tostring(profile.MetaData.SessionLoadCount)..	" time" .. ((profile.MetaData.SessionLoadCount > 1) and "s" or ""))
	if profile.Data.LogInGiift >= 120 then
		profile.Data.PlayerServices.Money = profile.Data.PlayerServices.Money + GiftMoney
		print(player.Name, "has been given a gift of $".. GiftMoney.. ".", "Actualmente tiene $".. profile.Data.PlayerServices.Money.. ".")
		profile.Data.LogInGiift = 0
	else
		print(player.Name .. " owns " .. tostring(profile.Data.PlayerServices.Money) .. " now!")
	end
end

local function PlayerAdded(player)
	local profile = PlayerProfileStore:LoadProfileAsync("Player_".. player.UserId, "ForceLoad")
	if profile ~= nil then
		profile:Reconcile()
		profile:ListenToRelease(function()
			cachedProfiles[player] = nil
			player:Kick("Tus datos no han sido cargados. Por favor Ășnase nuevamente/Your data has not been uploaded. Please join the game again")
		end)
		if player:IsDescendantOf(Players) then
			cachedProfiles[player] = profile
			DoSomethingWithALoadedProfile(player, profile)
		else
			profile:Release()
		end
	else
		player:Kick("No se pueden cargar tus datos. Por favor Ășnase nuevamente")
	end
	local GetCharacterLauncher = workspace:FindFirstChild(player.Name)
	if not GetCharacterLauncher then
		repeat task.wait(0.1)
			GetCharacterLauncher = workspace:FindFirstChild(player.Name)
		until GetCharacterLauncher
	end
	repeat wait()
		if profile.Data.PlayerServices.CharacterServices.Set_Health.Health >=  profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth then
			GetCharacterLauncher.Humanoid.MaxHealth = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
			GetCharacterLauncher.Humanoid.Health = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
		else
			GetCharacterLauncher.Humanoid.MaxHealth = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
			GetCharacterLauncher.Humanoid.Health = profile.Data.PlayerServices.CharacterServices.Set_Health.Health
		end
	until GetCharacterLauncher.Humanoid.Health == profile.Data.PlayerServices.CharacterServices.Set_Health.Health and GetCharacterLauncher.Humanoid.MaxHealth == profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
	
	player.CharacterAdded:Connect(function(char)
		local Humanoid = char:WaitForChild("Humanoid")
		if profile.Data.PlayerServices.CharacterServices.Set_Health.Health >=  profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth then
			Humanoid.MaxHealth = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
			Humanoid.Health = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
		else
			Humanoid.MaxHealth = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth
			Humanoid.Health = profile.Data.PlayerServices.CharacterServices.Set_Health.Health
		end
		Humanoid.Died:Connect(function()
			profile.Data.PlayerServices.CharacterServices.Set_Health.Health = profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth 
			--In this part you should restore the health data (not MaxHealth) to put that data in Health, humanoid
		end)	
	end)
	player.CharacterRemoving:Connect(function(char)
		profile.Data.PlayerServices.CharacterServices.Set_Health.MaxHealth = char.Humanoid.MaxHealth
		profile.Data.PlayerServices.CharacterServices.Set_Health.Health = char.Humanoid.Health 
		char.Humanoid:UnequipTools()
		--Here when exiting the game the data is saved perfectly, or that is what I think since when dying is when it gives the error, and I think that here is part of the problem
	end)
end

for _, player in ipairs(Players:GetPlayers()) do
	coroutine.wrap(PlayerAdded)(player)
end

local function PlayerRemoving(player)
	local profile = cachedProfiles[player]
	
	if profile ~= nil then
		profile:Release()
	end
	print(profile)
end

Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(PlayerRemoving)

function cachedProfiles:Get(player, yield)
	local profile = cachedProfiles[player]
	if yield and not profile then
		repeat task.wait(0.1)
			profile = cachedProfiles[player]
		until profile or (not player.Parent)
	end
	if profile then
		return profile
	end
end

return cachedProfiles