How to set 2 Types of "Fire" with a "Douse" for each type?

I have two types of “Fire” for the player characters and want to be able to wash out each type with a matching douse.

One problem is that both types are named “fire,” and I set different effects so they look different. I did try changing the names for each fire type with fire.Name = “Fire” and fire.Name = “FireA” when setting the PC on fire, but I’m not sure how to set the “douse” to distinguish between the two. Here’s what I have so far which only accounts for the basic single fire type. How can I setup the second fire and douse type?

Fire Script:

local firePart = script.Parent 

function lightOnFire(part) 
	local fire = Instance.New("Fire") 
	fire.Parent = part
end
	
firePart.Touched:connect(lightOnFire) 

Douse Script:

local waterPart = script.Parent

local function putOutFire(part)
	local fire = part:FindFirstChild("Fire")
	if fire then 
		fire:Destroy()
	end
end

Wouldn’t you just change Fire to FireA for the second example? Not sure what is the issue.

1 Like

I tried that. It didn’t work.
Perhaps I messed up in the “set on fire” part?

For the Fire Script, I did:

local firePart = script.Parent 

function lightOnFire(part) 
	local fire = Instance.New("Fire") 
    fire.Name = "FireA"
	fire.Parent = part
end
	
firePart.Touched:connect(lightOnFire) 


I also tried:

local firePart = script.Parent 

function lightOnFire(part) 
	local fire = Instance.New("FireA") 
	fire.Parent = part
end
	
firePart.Touched:connect(lightOnFire) 

My Douse was:

local waterPart = script.Parent

local function putOutFire(part)
	local FireA = part:FindFirstChild("FireA")
	if FireA then 
		FireA:Destroy()
	end
end

You can’t make custom instances. Change FireA in the second example to Fire but then name it FireA.

And it is Instance.new not Instance.New

1 Like

When I do that, it still puts out both types of “fire”

Here’s my adjusted scripts:

Fire Script

local firePart = script.Parent 

function lightOnFire(part) 
	local FireA = Instance.new("Fire") 
	FireA.Parent = part
end
	
firePart.Touched:connect(lightOnFire)

Douse Script

local waterPart = script.Parent

local function putOutFireA(part)
	local FireA = part:FindFirstChild("FireA")
	if FireA then 
		FireA:Destroy()
	end
end

waterPart.Touched:Connect(putOutFire)

For Reference, here’s the script for my other “Fire” type

function lightOnFire(part)
local fire = Instance.new("ParticleEmitter")
fire.Name = "Fire" 
fire.Texture = "rbxassetid://37332909"
fire.Size = NumberSequence.new(0.01,0.04)
fire.Rate = 4
fire.Lifetime = NumberRange.new(1,1.5)
fire.Speed = NumberRange.new(0, 1)
fire.SpreadAngle = Vector2.new(10,50)
fire.Color = ColorSequence.new(Color3.new(0,170,0))
fire.Parent = part

end

fireCollision = script.Parent 
fireCollision.Touched:connect(handleTouch)
fireCollision.Touched:connect(lightOnFire)

I did notice that the Fire script was adding both “Fire” and “FireA” to the PC, so, made this adjustment so ONLY “FireA” gets set on the PC.

local firePart = script.Parent 

function lightOnFire(part) 
	local FireA = Instance.new("Fire") 
	FireA.Name = "FireA"
	FireA.Parent = part
	local Fire = part:FindFirstChild("Fire")
	if Fire then
		Fire:Destroy()
	end
end
	
firePart.Touched:connect(lightOnFire)

The Douse still puts out Fire AND FireA though, and I don’t know why.

local waterPart = script.Parent

local function putOutFire(part)
	local FireA = part:FindFirstChild("FireA") 
	if FireA then 
		FireA:Destroy()
	end
end

waterPart.Touched:Connect(putOutFire)

Not the BEST solution, but it works for my purpose…
I’ll post here in case anyone else has a similar issue.
Thanks for all the help incapaz!

First off, the Douse part was named “Water” and that seemed to be an issue… once I renamed it “waterPart” the following worked for my purpose…

This “fix” does in fact allow a specific “Douse” to remove fire type “FireA,” but, when setting FireA, I’m also removing the other “fire” type. In my case, this is actually fine. :slight_smile: Here are the scripts.

Fire Script:

    function lightOnFire(part)

    local fire = Instance.new("ParticleEmitter")
    fire.Name = "Fire" -- defines so can remove when going back to lobby
    fire.Texture = "rbxassetid://37332909"
    fire.Size = NumberSequence.new(0.01,0.04)
    fire.Rate = 4
    fire.Lifetime = NumberRange.new(1,1.5)
    fire.Speed = NumberRange.new(0, 1)
    fire.SpreadAngle = Vector2.new(10,50)
    fire.Color = ColorSequence.new(Color3.new(0,170,0))
    fire.Parent = part
    end

    fireCollision = script.Parent
    fireCollision.Touched:connect(handleTouch)
    fireCollision.Touched:connect(lightOnFire)

FireA Script:

local firePart = script.Parent 

function lightOnFire(part) 
	local FireA = Instance.new("Fire") 
	FireA.Name = "FireA"
	FireA.Parent = part
	local Fire = part:FindFirstChild("Fire")
	if Fire then
		Fire:Destroy()
	end
end
	
firePart.Touched:connect(lightOnFire)

Douse for FireA Script:

local waterPart = script.Parent

local function putOutFireA(part)
	local FireA = part:FindFirstChild("FireA") 
	if FireA then 
		FireA:Remove()
	end
end

waterPart.Touched:Connect(putOutFireA)