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.
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