My code doesn't work but I think it's because I'm new to scripting
01 | function onTouched(hit) |
02 |
03 | if 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 |
10 | end |
11 | script.Parent.Touched:connect(onTouched) |
12 | 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
01 | function onTouched(hit) |
02 |
03 | if 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 |
12 | end |
13 | script.Parent.Touched:connect(onTouched) |
That is because your script contains some errors.
Here's a fixed version of it:
01 | function onTouched(hit) |
02 |
03 | if 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 |
08 | end |
09 | end |
10 |
11 | script.Parent.Touched:connect(onTouched) |