Hello,
If you aren’t aware, there is a module by @Quenty for syncing the server and the client’s tick. However, I don’t understand what this is used for. I’m aware it helps with sync between client and server in some way, but what’s the right way to use it? I’d like an example (like a bullet or something), and an explanation. Thanks in advance. 
2 Likes
You may want to use it if you are creating a bullet projectile system(calculating the bullet physics and if it hit on the server, rendering the flying bullet on the client).
You may want to use a synced tick() to compensate for latency. There are many more use cases for this as well.
Can you provide a code example?
Okay, I just wrote some pseudocode for anyone who might need help. I understand this for the most part:
local function onClientEvent(shootPlayer, startCFrame, endCFrame, tweenTime, time0)
local bullet = ...
local tweenConnection
tweenConnection = RunService.Heartbeat:Connect(function(delta)
local time = clock:GetTime() + delta
local currentTime = time0 - time
local alpha = currentTime / tweenTime
alpha = TweenService:GetValue(alpha, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
bullet.CFrame = startCFrame:Lerp(endCFrame, alpha) -- lerp the bullet’s cframe so it’s synced with all other clients
end)
end
1 Like