Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

Where did you put the script?

2 answers

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)

1 comment

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.

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.