Hello, recently i've been working on a fire and water script in which someone jumps into lava and takes damage, then jumps into the water and clears all the effects from the fire. This is my script for both.
local firePart = script.Parent
local Players = game.Players
firePart.Transparency = 1
local Lava = function(hitPart)
if hitPart.Parent:FindFirstChild("Humanoid") then
hitPart.Parent.Humanoid.Health = hitPart.Parent.Humanoid.Health - 3
if hitPart.Parent.Humanoid.Health > 0 then
local Parts = hitPart.Parent:GetChildren()
for i, Parts in pairs(Parts) do
if Parts:IsA("BasePart") then
Instance.new("Fire", Parts)
Instance.new("Smoke", Parts)
end
end
end
end
end
firePart.Touched:Connect(Lava)
thats my Fire script, and this next one is my water script
local waterPart = script.Parent
waterPart.Transparency = 1
local function PutOutFire(part)
local human = part:FindFirstChild("Humanoid")
for i, human in pairs(human) do
if human:FindFirstChild("Smoke") then
human:FindFirstChild("Smoke"):Destroy()
end
if human:FindFirstChild("Fire") then
human:FindFirstChild("Fire"):Destroy()
end
end
end
waterPart.Touched:connect(PutOutFire)
I am not sure where am going wrong, I don't get any errors, but the smoke and fire effect from the fire script doesn't leave even after I jump into the water. What do I need to change, and how can I make this better? Help will be much appreciated.

4 comments
whoooo, it worked! I have a few questions about it though, for example do you mean Humanoid is nil? If so, how do I know if it is or not? Sorry am kinda noob at this.
when referencing an object with an if statement the code is just returning a boolean value(true or false) on whether the object is not nil, if the if statement detects true then it runs the code under it
Alright, thanks for the explanation
np