I'm extremely new to scripting. I've been messing around and challenging myself to script certain stuff. Below is the code block, with some hopefully helpful comments.
Also, it's an edited version of the fire tutorial on the wiki.
My goal is to have my character be damaged when it touches the 'Lava1' part, taking 5 damage every second until it dies. And before my character touches the lava part, have it print "I am not on fire!"
wait(1) -- Waits for player to load in.
-- Variables for the lava, users, user HP, and checking to see if player has touched lava.
local Lava = game.Workspace.Lava1
local user = game.Players.LocalPlayer.Character.Humanoid
local userHP = game.Players.LocalPlayer.Character.Humanoid.Health
local userOnFire = Lava.Touched
-- Function that creates the fire effect.
function lightOnFire(part)
print("Going to light this part on fire:")
print(part.Name)
local fire = Instance.new("Fire")
fire.Parent = part
end
userOnFire:connect(lightOnFire) --calls upon function
-- The below code begins to damage me as soon as I launch the test.
-- Also, it doesn't stop even after I am dead.
-- However, it does not occur during my second life (after the character has re-spawned).
if userOnFire then
repeat
wait(1)
user:TakeDamage(5)
until
userHP <= 0
else
print("I am not on fire!")
end

3 comments
Is this in script or in local script?
What does the output shows you>
It's in script within the Lava1 part. The output shows no errors and prints the lightOnFire function correctly. 'print("I am not on fire!")' does not appear.