-
What do you want to achieve? Keep it simple and clear!
I’m trying to make functionality that uses os.clock() to determine when a certain month is in effect so I can try to “replicate” seasons in Ocean’s World. -
What is the issue? Include screenshots / videos if possible!
When I try to run the script, it errors on line 2, where a function is being defined, meanwhile…
Attempt to modify a readonly table-Line 2
here’s the code:
-- Custom string split function
function split_string(textstring, sep)
local fields = {}
local pattern = string.format("([^%s]+)", sep)
textstring:gsub(pattern, function(c) fields[#fields + 1] = c end)
return fields
end
-- OS Clock
local os_clock = os.date("%Y-%m-%d")
local os_splits = split_string(os_clock, "-")
-- Year, Month and Day
local year = os_splits[1]
local month = os_splits[2]
local day = os_splits[3]
- What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I’ve tried looking for solutions to the error, but apparently I’ve found nothing, and I can’t find any solution to this, so my last hope was here.
Please help ![]()
I hope u’ve drank ur water!
