How to make the mouse wheel scroll smoothly?

Hello. I wrote a script to scroll the mouse wheel. He changes the distance. I would like to know how I can make it scroll smoothly.

uis.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseWheel then
if input.Position.Z > 0 then
distance = math.max(distance-2,10) --This won’t get below 5
else
distance = math.min(distance+2,60) --This won’t go above than 15
end
end
end)

I dont know if this works but you could try using

local TweenService = game:GetService("TweenService")

I dont know exactly how to script this but you could use it to slowly transition into the number you want.

Use this: TweenService | Documentation - Roblox Creator Hub

1 Like

No. This is not exactly what I need.