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

I made this day night cycle script but I want it to change the time on the players computer time?

local minutes = game.ReplicatedStorage.ServerSettings.TimeOfDay
minutes.Value = math.random(100,5000)


while true do
	wait(2)
	minutes.Value = minutes.Value + 1
end

2 comments

0

So like a script that adapts to the real players time, and displays it ingame?

0

yes

2 answers

✓ Accepted answer

try this.. you would need to change the bit where i directly change the game.Lighting.TimeOfDayto the way you have it

while true do
	local t = os.date ("*t")
	--[[
	t returns the following table
		Field   / Example
		t.sec   = 18
  		t.min   = 13
		t.hour  = 10
  		t.day   = 25
  		t.month = 4
		t.year  = 2007
  		t.wday  = 4
  		t.yday  = 115
		t.isdst = false
		
		Example taken from https://www.gammon.com.au/scripts/doc.php?lua=os.date
  ]]
	local Secs = t.sec
	local Mins = t.min
	local Hour = t.hour
	
	print(Hour,":",Mins,":",Secs)
	game.Lighting.TimeOfDay = Hour..":"..Mins..":"..Secs
	wait()
end

This probably isn't good as you'd be giving away your time zone to other people, which can be narrowed down to where you live.

1 comment

0

i'm not sure now your making me nervous, lol i'll scrap the idea but thats for trying to answer!!!

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