I am firing a remote event to the server with the client’s tick (playerTime = tick()). I know that the server’s timezone can be different from the client’s timezone which would affect the tick()'s. So what I did was convert the seconds to hours so I can use it to get the seconds (since seconds are the same in all timezones). Subtracting the servers seconds to the clients seconds should give me the travel time from client to server but it’s giving me some wacky numbers. Also, this works perfectly in studio but not in-game. Can someone tell me what I’m missing?
event.OnServerEvent:Connect(function(player, playerTime)
local endTime = tick( )
local clientHours = playerTime / 3600
local clientMinutes = (clientHours % 1) * 60
local clientSeconds = (clientMinutes % 1) * 60
local serverHours = endTime / 3600
local serverMinutes = (serverHours % 1) * 60
local serverSeconds = (serverMinutes % 1) * 60
local timeDifference = serverSeconds - clientSeconds
end)
this way would allow for the time to synchronized since its based on utc and btw it is gonna print 0 seconds because remote event will fire in under second assuming low latency.
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dealDamageHelper:FireServer(os.time())
end
end)
Your method does work, but what I am trying to do is a little time sensitive so I am trying to get the exact time it takes for the event to travel from client to server (this same event does other stuff on server I just provided you with the barebones).