How do I make my NPC accelerate speed from 8 to 40?

So basically how would I script my NPC in the workspace, to accelerate speed faster? And if possible, how could I make this script compatible with a chase script?

You can use TweenService to accelerate the Humanoid’s speed, here is an example below:

local tweenInfo = TweenInfo.new(
	1 -- How much time it takes for the NPC to accelerate in speed.
)

local TweenService = game:GetService("TweenService")
local Tween = TweenService:Create(NPC.Humanoid, tweenInfo, {WalkSpeed = 40})

Tween:Play()
1 Like

You can use @Avzycx 's method.
But If you also want to deaccelerate the movement of NPC, you should make your own Custom Movement system.

For Example :

  • Using LinearVelocity to control Rig’s movement
  • Using AlignPosition to control Rig’s movement
  • Using VectorForce to control Rig’s movement

Honestly, I would recommend using LinearVelocity to achieve this.

And to make a custom movement system with LinearVelocity, you can do somethings like :

  • Set LinearVelocity’s Parent to Rig’s RootPart
  • Write a script that changes LinearVelocity’s VectorVelocity when Rig’s moveToPoint changes.
  • set Attachment0 to RootAttachment of RootPart
  • Write a script that changes decreases/increases the VectorVelocity when Rig starts moving/almost ends moving.
1 Like

Anyway to make the script reset once within range with a player?

For that you could use magnitude to detect if a player is near. And then use TweenService to gradually slow down the NPC’s walkspeed, or speed it up, im confused on what you meant.

2 Likes