Laverr54
(Laverr54)
#1
Guys, I am making a game in which every round there is a random map, and I want to make some maps Night and others Day, i don’t know how.
Right now, I am using a script that makes the whole game be day and after some seconds it becomes night, and then day again etc
local lighting = game:GetService(“Lighting”)
local minutes = 7 * 60
while wait() do
lighting:SetMinutesAfterMidnight(minutes)
minutes = minutes +1
end
I need Dark Forest to be night and Desert Ruins to be day, can someone help?
OKevinO
(OKevinO)
#2
You can simply set the TimeOfDay in Lighting when said map spawns.
Make sure to do this server sided so it replicates for all players.
1 Like
Laverr54
(Laverr54)
#3
What do you mean? I don’t know how to do that
OKevinO
(OKevinO)
#4
local lighting = game:GetService("Lighting")
lighting.TimeOfDay = "1:00:00"
if you’re just setting it to “1” you don’t actually need the “:” or the 0’s, but you do if you want to set the minutes and seconds as well.
You can check the Lighting service to see how the property “TimeOfDay” is formatted if that helps.
1 Like
Laverr54
(Laverr54)
#5
Thank you, it worked!
I made a script with different times for each map and put inside the maps, and deleted the DayNightCycle script i was using
Now my game will make more sense XD
1 Like