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

I made this Day/Night Script, Will it work?

Asked by 9 years ago
--Made by xMinerHaven, Hope you enjoy!--
--Version 1.4, Made on Thanksgiving 2015--
--Thanks for buying/using--

l = game:service("Lighting") 
r = game:service("RunService")

while true do 
l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+1) 
wait(.5)
end 

I'm not sure if it will work, but I'll leave it up to you guys.

3
"will it work" test it yourself... Perci1 4988 — 9y
0
Don't get the RunService unless you need it, which in this case you don't, I believe that service would only work in LocalScripts which would cause error in a Server Script in server mode. Also, :service is deprecated and should not be used in new work, use :GetService instead. M39a9am3R 3210 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

It works, well for me it works.. Not sure on a public server

Ad
Log in to vote
0
Answered by
ImfaoXD 158
9 years ago

Here's a better day/night script. I used some of your codes and upgraded it. I spend almost 30 minutes on it but here you go, xMinerHaven. All you have to do is put this into a normal script and place it in work space.

DAY_TIME_IN_MIN = 15 



local dhour = 10
local dmin = 0
while true do
    wait(DAY_TIME_IN_MIN/24) 
    dmin = dmin + 1
    if dmin >= 60 then
        dmin = 0
        dhour = dhour + 1
        if dhour >= 24 then
            dhour = 0
        end
    end
    game.Lighting.TimeOfDay = dhour..":"..dmin
end
0
It's not really better at all to construct a string like that for the time. BlueTaslem 18071 — 9y

Answer this question