Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago
Edited 5 years ago

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:

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

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

Log in to vote
3
Answered by 5 years ago

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

01while wait() do
02    local Data = os.date("t")
03    local Months = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}
04    local Date = script.Parent:WaitForChild("Date")
05    local Time = script.Parent:WaitForChild("Time")
06    for i,v in pairs(Months)do
07        if Data.month == i then
08            Date.Text = v.."/"..Data.day.."/"..Data.year
09        end
10    end
11    Time.Text = Data.hour.."t"..Data.min.."t"..Data.sec
12end
0
His idea is correct. CrastificeDude612 71 — 5y
Ad

Answer this question