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

My script doesn't set burning people on fire. How to fix this?

Asked by
kedny23 -14
6 years ago

My code doesn't work but I think it's because I'm new to scripting

function onTouched(hit)

if script.Parent.LeftLowerLeg.Fire.Enabled = true
    then while true do ()
        local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then
                human.Health = human.Health - 10 -- Change the amount to change the damage.
                    wait(5)   
    end
end
script.Parent.Touched:connect(onTouched)
end

plz help

0
Where did you put the script? Godlydeathdragon 227 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

I think it's because you put enabled = true then when you should've put enabled then. I also think it's because you put () beside while true do, that's incorrect you also put a end after script.Parent.Touched:connect(onTouched) that would break the script

function onTouched(hit)

if script.Parent.LeftLowerLeg.Fire.Enabled then
     while true do
        local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then
                human.Health = human.Health - 10 -- Change the amount to change the damage.
                    wait(5)   
            end
        end
    end
end
script.Parent.Touched:connect(onTouched)
0
"Fire.Enabled" and "Fire.Enabled == true" are resolved to the same thing. The real problem is that "=" is the assignment operator. Kedny23 wants the "==" boolean equivalence operator. fredfishy 833 — 6y
Ad
Log in to vote
0
Answered by
luadotorg 194
6 years ago

That is because your script contains some errors.

Here's a fixed version of it:

function onTouched(hit)

if hit.Parent:FindFirstChild("LeftLowerLeg").Fire.Enabled == true then
        local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then
                human.Health = human.Health - 10
        end
end
end

script.Parent.Touched:connect(onTouched)

Answer this question