Hi, I’m wondering how i can make acceleration code in Roblox I tried searching everywhere but i couldn’t find de answer how to make acceleration code.
its easiest to do with loops and I think its most efficient with repeat until loops like
repeat wait(0.1)--change wait() to whenever the speed increases
acceleration += 1 --change depending on speed
until acceleration = 200 --change to the max acceleration
It’s good but if you accelerate how do you decelerate.
repeat wait(0.05)
acceleration -= 1
until acceleration = 0
Instead of using a repeating loop, you can just use a VectorForce. Set the direction of the force to go in the direction that you want, and you’ll have a smooth acceleration (depending on the mass of the object, you may need to increase the total force a bit)
But how can I use it on the default Roblox movement?
Do you mean how to make the player accelerate instead of instantly going fast when moving (such as in those clicker running game thingies)?
do you mean walking speed or something else
Roblox default movement has no acceleration it goes like 1 - 16 in a second so I tried making a code to make it accelerate but it didn’t work.
repeat wait(0.1)
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed += 0.1
until game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed == 32
oh sorry I read it wrong heres the corrected script
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Walkspeed = 1
repeat wait(0.1)
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Walkspeed += 1
until game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Walkspeed == 16
I think this is right idea how to make it. but I think I’m gone try using vector force and experiment with it. Thank for the help
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.