Is there any possible way I can get a player’s local time when they join a game via ServerScript? This is what I’ve tried doing; however, it only returns Roblox’s server time.
I don’t think you need to use a RemoteEvent, technically ModuleScripts are LocalScripts and they can use game.Players.LocalPlayer, maybe you can try that?
-- Server Script (game.ServerScriptService)
game.Players.PlayerAdded:Connect(function(Plr)
local dt = require(Plr.PlayerGui:WaitForChild("ModuleScript")).getTime("*t",os.time())
print((tostring(dt.hour) .. "." .. tostring(dt.min) .. tostring(dt.sec)))
end)
-- Module Script (game.StarterGui)
local module = {}
function module.getTime(f,t)
return os.date(f,t)
end
return module
And how are you sure that it is actually your local time?
When you run os.date() in a serverscript, it will return the time based on where the roblox server is located irl. Testing it in roblox studio would not work because it is only your computer thats hosting the “server”, therefore it would return your local time. However if you were to try this in roblox instead, then it would return a different time based on where the roblox server is from.
In this case you ran it inside of roblox studio, which returned 8pm, but if you were to publish the game and play it in roblox, then it would return a different time. You see where I’m going with this?