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

Real time script works in Studio but shows a random time in client?

Asked by 6 years ago

My Realtime script works in Studio but not in the client (press play on the game). It shows just a random time. It's in GMT or BST.

-- Ganondude

local time_zone = -5        -- Time zone, offset from GMT.

local tz_diff = 5*3600 + time_zone*3600
local secondsInDay = 60*60*24

while true do
    game.Lighting:setMinutesAfterMidnight(math.fmod(tick() + tz_diff,secondsInDay)/60)
    wait(0.1)
end

0
in studio, tick() is from your computer. in roblox servers, its the time from Roblox's server. Run this from a localscript and it should probably work as expected. You can also use os.time() instead of tick(), iirc. which will be the same across any script. RubenKan 3615 — 6y
0
Do i just leave it in Workspace as a local script? CarlPlandog 20 — 6y
0
Nevermind, put it into StarterPlayerScripts and it's working. Thanks. CarlPlandog 20 — 6y

Answer this question