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
7 years ago

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

01function onTouched(hit)
02 
03if script.Parent.LeftLowerLeg.Fire.Enabled = true
04    then while true do ()
05        local human = hit.Parent:findFirstChild("Humanoid")
06        if (human ~= nil) then
07                human.Health = human.Health - 10 -- Change the amount to change the damage.
08                    wait(5)  
09    end
10end
11script.Parent.Touched:connect(onTouched)
12end

plz help

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

2 answers

Log in to vote
1
Answered by 7 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

01function onTouched(hit)
02 
03if script.Parent.LeftLowerLeg.Fire.Enabled then
04     while true do
05        local human = hit.Parent:findFirstChild("Humanoid")
06        if (human ~= nil) then
07                human.Health = human.Health - 10 -- Change the amount to change the damage.
08                    wait(5)  
09            end
10        end
11    end
12end
13script.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 — 7y
Ad
Log in to vote
0
Answered by
luadotorg 194
7 years ago

That is because your script contains some errors.

Here's a fixed version of it:

01function onTouched(hit)
02 
03if hit.Parent:FindFirstChild("LeftLowerLeg").Fire.Enabled == true then
04        local human = hit.Parent:findFirstChild("Humanoid")
05        if (human ~= nil) then
06                human.Health = human.Health - 10
07        end
08end
09end
10 
11script.Parent.Touched:connect(onTouched)

Answer this question