I am trying to create a script that burns you when you touch a part but I have three "if end" statements in a row which is why I believe it is not working.
if humanoid then
if not firecheck then
if not smokecheck then
Please try to fix this for me and explain what I did wrong so I know what to do for next time.
local lava = script.Parent
local fire = Instance.new("Fire")
local smoke = Instance.new("Smoke")
lava.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local firecheck = hit.Parent.Torso:FindFistChild("Fire")
local smokecheck = hit.Parent.Torso:FindFistChild("Smoke")
if humanoid then
if not firecheck then
if not smokecheck then
end
fire.Parent = hit.Parent.Torso
smoke.Opacity = 0.1
smoke.Parent = hit.Parent.Torso
for steps = 1, 10, 1 do
humanoid:TakeDamage(5)
wait(1)
end
fire:Destroy()
smoke:Destroy()
end
end
end)

6 comments
Any errors?
Also make sure your if statements are embedded in each other because it looks like two are just next to each other
What do you mean?
You should indent your code correctly. http://wiki.roblox.com/index.php?title=Lua_Style_Guide#Whitespace_Rules
you need multiple ends, one end for every if
For shortening your code, you can do "if humanoid and not firecheck and not smokecheck then" instead of what you did.