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:

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

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

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
0
His idea is correct. CrastificeDude612 71 — 5y
Ad

Answer this question