I only just started to learn how to script yesterday, and I have come across this issue, and I do not know how to do it, I've read about else and elseif but I believe they function as the opposite of what I need. Basically I'm trying to make a script that will light a player's unlit hand-torch when it comes into contact with a block that is on fire.
I have tried two methods out, both appear to work in testing however I am not sure if one is a correct way of doing it, or if they're both wrong.
function light(hit)
if script.Parent.Fire.Enabled == true and hit.Fire.Enabled == false then
hit.Fire.Enabled = true
hit.Light:Play()
end
end
script.Parent.Touched:connect(light)
function light(hit)
if script.Parent.Fire.Enabled == true then
if hit.Fire.Enabled == false then
hit.Fire.Enabled = true
hit.Light:Play()
end
end
end
script.Parent.Touched:connect(light)

1 comment
Thank you very much for that tip! I didn't know that :)