Need help making a spreading fire script

i’ve been working on a script for fire to spread through objects, i went through some issues though, the fire just instantly spreads and even when a non fire object touches it it gets set on fire.

this is the script:

part = script.Parent

function OnPartTouched(f)

wait(2)
part.BrickColor = BrickColor.New("Really black")
wait(2)
part.Anchored = false
wait(2)
part.Transparency = 1
part.CanCollide = false
wait(1)

end

part.Touched:Connect(OnPartTouched)

Are you sure this is the right script? Nothing in here would set parts on fire.

Isn’t that what’s supposed to happen? Fire is supposed to spread through objects. Please describe the issue of your code more.

there is no pause in-between fire spreading so they all burn at once

Use a delay each time a fire successfully burns an object.

_G.stopFire = false

script.Parent.Touched:Connect(function(f)

if _G.stopFire == false and f.BrickColor ~= "Really Black" then

_G.stopFire = true

task.wait(2)
f.BrickColor = BrickColor.New("Really black")
task.wait(2)
f.Anchored = false
task.wait(2)
f.Transparency = 1
f.CanCollide = false
task.wait(1)

_G.stopFire = false

end

end)

I dont know why u set the Part to fire when touched, you could set the other Part to fire, so not setting “part” to fire, instead setting “f” to fire. I used connection so other Parts will not set to fire until when another Part is getting fired.

when i posted this i was very new at coding