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

How do i fix this Warning? What Ever i do it turns into a Error.

function Qclick(Question)

if script.Parent.Parent.Visible == true then

	while true do 

		wait()

		local questiontochoosefrom = math.random(1,23)

		if questiontochoosefrom == 1 then 

			question.Text = "What is E1?" if

			textbox.Text == "Airman Basic" then 

			wait(35)

			correction.Text = "Correct" elseif

			correction.Text == "The Correct Answer is Airman Basic"	then	

			end 

			wait(35)

		end

textbox.Text =="Airman Basic" then keeps getting Warning W006:(14,5) Statement spans multiple lines; use indentation to silence

1 answer

✓ Accepted answer

You are indenting your code very strangely.

if, and elseif should always begin new lines.

if and then should be on the same line.

elseif and then should be on the same line.

The indent should increase after then and decrease at end.

Correctly formatted (using the above rules), your code looks like this:

if script.Parent.Parent.Visible == true then
	while true do 
		wait()
		local questiontochoosefrom = math.random(1,23)
		if questiontochoosefrom == 1 then 
			question.Text = "What is E1?"
			if textbox.Text == "Airman Basic" then 
				wait(35)
				correction.Text = "Correct"
			elseif correction.Text == "The Correct Answer is Airman Basic" then    
			end
			wait(35)
		end

This is clearly not right.

  • The code isn't complete; the if and while are still open

  • A while starting in an if that isn't in an event is probably not what you mean

  • You compare correction.Text == "<some long message>" even though you don't set it...

  • You ask a question, and then immediately check the answer....

  • You have an empty elseif

  • You have two instances of wait(35) inside the same loop

1 comment

0

Thanks, I'm pretty new to coding lua.

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