Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script isn't checking the if statements. How do I fix this?

Asked by 3 years ago
            if hit.Material == Enum.Material.Wood then

                if hit.IsBurning.Value == true then
                    return

                elseif hit.IsBurning.Value == false then

                    if hit:FindFirstChild("FireSpreadNormal") then
                        return
                    else
                        local catchTime = math.random(5, 10)
                        wait(catchTime)

                        hit:BreakJoints()
                        hit.IsBurning.Value = true
                        hit.Anchored = false
                        hit.BrickColor = BrickColor.new("Black")

                        if hit:FindFirstChild("FireSpreadNormal") then

                        else
                            SpreadFireScript(hit)
                        end


                    end

                end

            elseif hit.Material == Enum.Material.Concrete then
                print("Cannot burn")
            end

So, I am making a fire spreading script and I wanted to make the fire not spread to parts/objects that are made of non-burnable materials such as concrete. For some reason the script does not follow the if statements but just does first "if". I have no idea why this isn't working.

P.S: "hit" is a variable for the part that touched the burning part. <<--- Don't know if that will help but just in case.

0
do you know how to use return Blackbooks 138 — 3y
0
Do you have it on a constant loop? blocky010101 23 — 3y
0
You are using return after 2nd if statement... So the script will stop there Feelings_La 399 — 3y
0
Oops, my bad. I think you have a constant loop in your script that is above your if statement? Feelings_La 399 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You should put the line 30&31 to line 05 because your actually checking if the part is not burning before the part material

Ad

Answer this question