so i have a game where it always need to be night, but i need the TimeOfDay for clocks, which are important for the game, so is there an option to make timeofday not affect sunrise and sunfall?
Is there any code you have for the clocks?
its a simple clock using the time
local Gui = script.Parent
function getLightingTime()
local totalMinutes = game.Lighting:GetMinutesAfterMidnight()
local hours = math.floor(totalMinutes / 60)
local minutes = math.floor(totalMinutes % 60)
local period
if hours < 12 then
period = "\nAM"
else
period = "\nPM"
hours -= 12
end
if hours == 0 then
hours = 12
end
return string.format("%02d:%02d %s", hours, minutes, period)
end
while true do
Gui.Text = getLightingTime()
wait()
end
i could do a CUSTOM time system instead of using the clocktime but i would try to avoid it if i can
it worked by making the GeographicLatitude a very high number, but then it dosn’t work on graphic quaility lower than 5
You could keep the in-game time at a certain time (e.g. 12am), and use something like the DateTime data type to set the clock displays if you want to use the player’s real time.
Going based off your code:
local Gui = script.Parent
while true do
local dt = DateTime.now()
Gui.Text = dt:FormatLocalTime("LT", "en-us"))// This would provide the same format as your original code with hours, minutes, and period.
wait()
end
the game is running on lighting’s TimeOfDay, there is another script that adds 2 minutes every 0.5 seconds, so i don’t think regional time would work.
Ah, I see. Then what you could probably do, if the TimeOfDay is only set once in the game, is just add 2 to a local variable… wait never mind, what I thought of wouldn’t work because of how scripts work.
yeah ima just use custom time system
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.