Much like how in real life, you don’t start from going 1 mph to 70 mph. You start from 1 mph, 2 mph, 3 mph and so on all the way to 70 mph. Is this possible to recreate this in roblox without using a vehicle? If so, how?
You can use the TweenService to tween you’re way up!
All you’d have to do is set it up so that it tweens up to the max speed and tweens down (if you want to do that, though):
local TweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingStyle.Out) --sine is ma fav!
local toMax = TweenService:Create(humanoid, TweenInfo, {WalkSpeed = 16})
toMax:Play()
--do the same with slowing down
In the character movement controller, you can lerp the Vector3 of the speed of the character. I’ve used this in projects to achieve this ‘real life’ movement effect.
There are some issues with that though. AutoRotate will still rotate the character even if the Vector3 is 0.01, 0.01, 0.01
so even if the Player is going slow, the character will still rotate.
It’s an efficent way to do it and if you don’t mind AutoRotate, then so be it.
If not, just use @TheCarbyneUniverse tweening method.
I did this with a jump script I once made where repeatedly jumping caused you to speed up and walking w/o jumping slowed you back down to normal speed.
This was quite easy to achieve, you simply start with a slow walkspeed and check for the velocity of the HumanoidRootPart/Torso, if velocity is more than 0.5 for example, keep increasing walkspeed by like 0.03 (some small value) with each heartbeat until it reaches said speed limit, if they stop moving, slowly decrease it each heartbeat.
Don’t make it tied to renderstep, ever, unless you know how to use delta time, players with low/high framerate or using FPS unlocker for example will gain unfair (dis)advantages, don’t think heartbeat is frame tied tho, might want to use the delta value as well, just in case it destabilizes, since it’s like a alternate framerate thing, if it ends up being render frame tied and giving unfair (dis)advantages, just use wait() instead (sounds cheap and like bad practice, I know, but if it works it works).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.