Recording my car actions and then replaying it

Hello. I have made a car and I now try to record the actions the car does (where it moves, turns, etc.), It seems I can record the data but the problem lays in replaying which causes issues that I cannot understand. I loop through the record data table and apply that to the new car.

Record Script:

Replay Script

Thanks for anyone helping me.

I’d be surprised if anyone implemented something like this before. It’s certainly a feature that needs engine-level support.

task.wait() can yield for a varying amount of time, it’s return value is how long it actually waited for. It could be 0.016 seconds (about one frame) or much more. Simple and/or old game would use a variable time scale to keep the game from slowing down when the framerate is low, simply put slower computer → faster movement speed. We need fixed steps to create determinism and thus replays. Roblox seems to be doing the same, under the hood there might be something fixed-step because physics usually does so.

I think the closest you can get to what you want to achieve is connecting to BindToRenderStep, with a priority of 101. Or simply recording positions at timestamps and tweening between those positions.

If you are recording inputs and hoping to have the replay physics work exactly like the input physics it won’t work because Roblox’s physics don’t repeat exactly, especially with something as complex we a car. You will have a better result copying the position of the car after inputs, rather than copying inputs to get the position.

i fixed it, I just need to record the time on os.clock() and then record it on client, and replaying works too for me