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

Help with getting timer script to work, somehow using else instead of end?

Hello, I am making a timer script that counts in Hours, Minutes, and Seconds, but at line 13 it always says "Expected 'end' (to close 'else' at line 12'), got else. No matter how many "end"s I put, the problem is never fixed. Here is the LocalScript:

function Count()
	wait(1)
	Seconds = Seconds - 1
	if Seconds == 0 then
		Minutes = Minutes - 1
		if Minutes == 0 then
			Hours = Hours - 1
			end
	end
	if Hours > 9 then
    if Minutes > 9 then
	if Seconds > 9 then
	script.Parent.Parent.Timer.Text = Hours..":"..Minutes..":"..Seconds
	else
	else
		else
	if Minutes > 9 then
    if Seconds > 9 then
	script.Parent.Parent.Timer.Text = "0"..Hours..":"..Minutes..":"..Seconds
else
	else
	if Seconds > 9 then
	script.Parent.Parent.Timer.Text = "0"..Hours..":0"..Minutes..":"..Seconds
	else
	script.Parent.Parent.Timer.Text = "0"..Hours..":0"..Minutes..":0"..Seconds

3 comments

0

Indent your code properly. Not to be rude, but I can't read this giant mess.

0

If this is your whole Count() function, then please make sure that each if-statement is paired with an end. This is what this warning is telling you.

0

That script kills my eyes.

1 answer

Bundling 'if' statements into each other can cause errors. Place ends at the end of each 'if' statement or use the elseif condition.

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