How to make VectorVelocity end smoothly

I’ve got this script here

local UIS = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local Player = game.Players.LocalPlayer
local Character = script.Parent.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local HumRootPart = Character:WaitForChild("HumanoidRootPart")

local camera = game.Workspace.CurrentCamera

local DownTween = TweenService:Create(Humanoid, TweenInfo.new(0.4, Enum.EasingStyle.Exponential), {
	CameraOffset = Vector3.new(0,-1.77,-0.8)
	
})
local DownFOVTween = TweenService:Create(game.Workspace.CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Exponential), {
	FieldOfView = 100

})
local UpFOVTween = TweenService:Create(game.Workspace.CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Exponential), {
	FieldOfView = 85

})
local UpTween = TweenService:Create(Humanoid, TweenInfo.new(0.4, Enum.EasingStyle.Exponential), {
	CameraOffset = Vector3.new(0,0,-0.8)

})

--99893655201485

local SlideStartTrack = Animator:LoadAnimation(script.Slide1)
local SlideContinueTrack = Animator:LoadAnimation(script.Slide2)

UIS.InputBegan:Connect(function (input)
	if input.KeyCode == Enum.KeyCode.C or input.KeyCode == Enum.KeyCode.ButtonB then
		DownFOVTween:Play()
		DownTween:Play()
			SlideContinueTrack:Play()
		local LinearVelocity = Instance.new("LinearVelocity")
		LinearVelocity.Parent = HumRootPart
		LinearVelocity.Attachment0 = HumRootPart.RootAttachment
		LinearVelocity.MaxForce = 100000
		LinearVelocity.VectorVelocity = HumRootPart.CFrame.LookVector * 50
		LinearVelocity.Enabled = true
		wait(0.5)
		LinearVelocity:Destroy()
		
		print(HumRootPart.AssemblyLinearVelocity)
		repeat task.wait(0.1) until HumRootPart.AssemblyLinearVelocity.Magnitude <= 18
		SlideContinueTrack:Stop()
		UpTween:Play()
		UpFOVTween:Play()
	end
end)

I want to know how I could make a tween that could smoothly stop the player instead of using Destroy() which kind of creates an abrupt stop.

Hi!

Maybe try using TweenService for the velocity?

This could not work, but it’s worth trying.

1 Like