How do we calculate the speed of steering using delta time?

I’m trying to learn how to rig a car following Sleitnick’s tutorial How to rig a car . I have one question that i want to ask? How can the steering speed be calculated in this way:

> local steergoal = -seat.SteerFloat * 30
> local steer = steer + (steergoal-steer) * math.min(deltatime*seat.TurnSpeed,1)

i have little experience in runservice and anything related to this service so please go easy on me.

What is the deltatime variable defined as?

the delta time is a parameter that is passed through the function of heartbeat

really sorry for the late reply

No problem. I believe what the delta time is doing here is that it’s running every frame, so as to provide a smooth turn/steer effect.

could you explain it a little bit clearer cause i don’t have much experience on runservice. I only know barely what the devhub provide

So, you know how Heartbeat runs every frame?

The deltaTime parameter basically provides a parameter between each event (take this with a grain of salt, not an expert on this).

Try running this code in the command bar: local e = game["Run Service"].Heartbeat:Connect(function(deltaTime) print(deltaTime) end) wait(5) e:Disconnect()

This basically prints the deltaTime to help you visualize it.
Here’s a random tutorial I found, hope it helps.

so from what i understand is what Sleitnick do is to calculate how many degree to spin during each frame right? It is kind of too confused right now

Nope no calculations involved really, what it does is lerp the current steer towards the goal steel.

local function lerp(start, goal, alpha)
    return start + (goal - start) * alpha
end
--Notice the similarities with the below steer equation?
--local steer = steer + (steergoal-steer) * math.min(deltatime*seat.TurnSpeed,1)
--alpha is equal to 
--deltatime*seat.TurnSpeed

@ThanksRoBama explains the equations behavior and hence it’s purpose in another similar post:

TL;DR:
Provide responsive fast controls but doesn’t directly go towards the goal so you can do stuff like tapping input in order to control the car better at small turn speeds.

that is strange, i check again the equation of sleitnick and it doesn’t work anymore! it spins quite litte compare to yesterday when i did it

and the part you say about it gets closer to the target speed, it accelerates slower and slower. What do you mean by that? it starts to get really confused now.

and one more thing that i want to ask, why should we use the localscript to drive the car instead of the serverscript