DateTime.now() works in studio but not in game

Hello!
There seems to be something wrong with the DateTime function, heres the code:

local dt = DateTime.now()
local hour = dt:FormatLocalTime("H","en-us")

Right now, im getting the time of the players and set the lighting. It works perfectly in studio. But when in game it keeps getting daytime (its currently 8pm here). So I tried printing the outputs from the servers in the game. The result is that everytime. It goes 13. Anyone know how to fix this? I never used DateTime before so I might be bad.

Please help!

Well, if this code is running directly on the server, it would be getting the servers time. To get the players time this would need to be in a local script.

1 Like

Wait, i got a question? Where is the servertime located anyway (i was just curious :rofl:)