I was following a tutorial from Roblox and ran into a problem when I was trying to run the script even though I've followed the instructions to point. Here's what I got:

function LightOnFire(part)
	print("Going to light this part on fire:")
	print(part.Name)

	fire = Instance.new("Fire")
	fire.Parent = part
end

firePart = game.Workspace.Lava
firePart.Touched:connect(LightOnFire)

Anyone got any idea what the problem is?

8 comments

0

Is there anything showing up in the "Output"?

0

Nothing at all :/

0

Not even the "Going to light this part on fire:" ?

0

Oh, I have found my problem; I had another function above it for the changing of day, so I removed it and it began to work. Why is that?

0

Was that function a while loop?

0

Yeah

1

Okay. Well, that's why. Scripts are read from top to bottom, left to right, by Lua. So if there's a while true do or any type of never-ending loop, Lua will never execute anything after the loop. Lua won't execute any code out of order ever.

0

Oh, I see since it's a loop Lua can never move on to the next line. Thanks alot