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

LocalScript:3: ')' expected near ',' - How to fix?

Hi. I'm trying to make a real-time clock for use in my game, but it says Players.LuckyCGT.PlayerGui.Clock.LocalScript:3: ')' expected near ','

This is the code:

while wait()do
	local Data = os.date("t")
	local Months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	local Date = script.Parent:WaitForChild("Date")
	local Time = script.Parent:WaitForChild("Time")
	for i,v in pairs(Months)do
		if Data.month == i then
			Date.Text = v.."/"..Data.day.."/"..Data.year
		end
	end
	Time.Text = Data.hour.."t"..Data.min.."t"..Data.sec
end

The comma that is "broken" is the one between "Jan" and "Feb". I've tried putting a bracket where the comma is on line 3, but that still doesn't do anything.

Any help would be appreciated.

1 answer

It appears you want to make Months into a table. To do this you must use curly braces { } and not parenthesis. Below is the modified script

while wait() do
    local Data = os.date("t")
    local Months = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}
    local Date = script.Parent:WaitForChild("Date")
    local Time = script.Parent:WaitForChild("Time")
    for i,v in pairs(Months)do
        if Data.month == i then
            Date.Text = v.."/"..Data.day.."/"..Data.year
        end
    end
    Time.Text = Data.hour.."t"..Data.min.."t"..Data.sec
end

1 comment

0

His idea is correct.

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