how could make an acceleration/deceleration script apply to a driver seat without changing the torque because then it prevents the vehicle from acceleration
local Seat = script.Parent
local Train = Seat.Parent
local Body = Train.Body
local LBogie = Train.LBogie
local RBogie = Train.RBogie
speed = 500
acceleration = 0.1
deceleration = 0.2
Seat.Changed:Connect(function()
LBogie.Seat.Throttle = Seat.Throttle
RBogie.Seat.Throttle = Seat.Throttle
end)
LBogie.Seat.MaxSpeed = speed
RBogie.Seat.MaxSpeed = speed
You can simply apply or decrease the Throttle in a loop, based on if you either want to accelerate or decelerate.
Example function:
local acceleration = 0.01
local deceleration = 0.02
local isAccelerating = false
local isDecelerating = false
local function updateThrottle()
while isAccelerating do
if seat.Throttle < 1 then
seat.Throttle = seat.Throttle + acceleration
end
wait()
end
while isDecelerating do
if seat.Throttle > -1 then
seat.Throttle = seat.Throttle - deceleration
end
wait()
end
end