Need help with freezing and heating script

I am trying to make a script where you lose body tempreature over time, and once you get to 93 body tempreature you start to die. You can also get body tempreature back by standing next to a campfire, which I called heatArea. Something is very messed up with it though, because when you go in the heatArea, it goes up in heat way more than it should, and you can go in and out of the heatArea to get very warm. Also sometimes you will start dying out of nowhere even if you are not at 93 body tempreature. I also don’t know how to make it so that you can only go up to 100 body tempreature. Please help.

local temp = 98.6
local counter = 93



local player = game.Players.LocalPlayer
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local heatArea = game.Workspace.Campfire.Heat
local sound = player.PlayerGui:FindFirstChild("Freezing")


local GUIText = game.ReplicatedStorage:WaitForChild("GUIText")

local function heat()
	wait(3)
	temp = temp + 0.5
	counter = counter + 0.5
end

	
while true do
	GUIText.Value = temp
	wait(5)
	temp = temp - 0.5
	if temp <= counter then
		humanoid.Health = humanoid.Health - (humanoid.MaxHealth/4)
		counter = counter-1
		sound:Play()
	else
		heatArea.Touched:Connect(heat)
	end
end

Try this:

local temp = 98.6
local counter = 93

local player = game.Players.LocalPlayer
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local heatArea = workspace.Campfire.Heat
local sound = player.PlayerGui:FindFirstChild("Freezing")

local GUIText = game.ReplicatedStorage:WaitForChild("GUIText")

local debounce = false
function heat(hit)
	if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) == player and not debounce then
		debounce = true
	end
end

heatArea.Touched:Connect(heat)

while true do
	GUIText.Value = temp
	wait(5)
	if debounce then
		local distance
		repeat
			temp = math.min(temp + 0.5, 100)
			GUIText.Value = temp
			wait(3)
			distance = player:DistanceFromCharacter(heatArea.Position)
		until distance > 6 -- If the character moves 6 studs away from heatArea it will stop healing
		debounce = false
	end
	temp = temp - 0.5
	if temp <= counter then
		humanoid.Health = humanoid.Health - (humanoid.MaxHealth/4)
		sound:Play()
	end
end