Accelerating and deccelerating using CFrame and tween service

Hey devs! I am trying to make a drivable train and I’ve ran into some problems.

Basically I want to use CFrame to make the train run smoothly and not derail. While this works really good, I want it to make it that you decide how fast and how slow it goes. Any tips on that? With CFrame and TweenService you can only decide how fast it goes by the time you want it to finish.

I’ve tried looking for calculating the time with speed but it doesn’t help as I can’t really slow down then.

Thanks for reading this.

Have you tried using physics to move the train rather than using position methods?

Yeah, but it can derail really fast and I know it is more realistic, but I’m just seeing if this option is available.

You can make the speed of the train be a value, and then, via a script that uses services as UserInputService to detect when the keys W/S are triggered, then with a remoteevent, make the speed in the value raise or reduce while the keys are pressed.

1 Like