Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

--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.

2 comments

3

"will it work" test it yourself...

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.

2 answers

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

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

1 comment

0

It's not really better at all to construct a string like that for the time.

This discussion is preserved as it was. New answers, comments, and votes are closed.