It's supposed to spread fire to the brick that it's touching but it wont work on bricks that it's already in contact with.
local Target = script.Parent.Spreadable function makefire(parent) local fire = Instance.new("Fire") fire.Parent = parent end makefire(Target) Target.Touched:connect(function(spreadto) wait(1) makefire(spreadto) end)
It only would spread to the other bricks when I moved them away and back onto the part. Help? Thanks.
You can use the method GetTouchingParts()
to set fire to the parts that are initially touching the fire without moving:
local touching = Target:GetTouchingParts() for _, part in next, touching do wait(1) makeFire(part) end
However, this will wait 1 second everytime it checks a part. So if there are 10 touching parts, the 10th part will wait 10 seconds.
To fix this we can use the function spawn (or coroutines, which ever you prefer) to run the desired function on a separate thread:
local touching = Target:GetTouchingParts() for _, part in next, touching do spawn(function() wait(1) makeFire(part) end) end