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
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)
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)