Scrolling bar inaccuracy

Hello, tried making a custom scrollbar and i got a pretty good product eventually,

As you can see, there’s a small inaccuracy.
Here’s the main mathematical stuff.

local Relative = script.Parent.Parent.ScrollBackground.Frame.AbsolutePosition.Y - Mouse.Y
local Max = script.Parent.Parent.ScrollBackground.Frame.AbsolutePosition.Y + script.Parent.Parent.ScrollBackground.Frame.AbsoluteSize.Y
local Product = math.clamp(((Relative)/Max)*-2,0,1)
script.Parent.Parent.ScrollingFrame.CanvasPosition = script.Parent.Parent.ScrollingFrame.CanvasPosition:Lerp(,(script.Parent.AbsoluteCanvasSize.Y - script.Parent.AbsoluteWindowSize.Y)*Product),0.3) 

Any help is appreciated :))

1 Like

i dont see any inaccuracy mind telling where

You can see my mouse is going “faster” than my scrolling bar, if i put my mouse at the correct position it doesn’t go all the way down

so i did make a simple formula to do so

local mouse = --mouse
local ui = -- ui
local ypos = mouse.Y -ui.AbsoluteSize.Y

I’m already doing it this way (charrssss

then remove the lerp and use tween (WAIT NVM i am wrong)

That doesn’t change anything, they’ll do the exact same thing.

yea i legit have no clue whatsoever :confused: let me dig in more

yea i have no clue what so ever can u send me the entire script?

The entire script is just render stepped and checking if the mouse is clicked down, you won’t need it.

render stepped may cause that lag use .moved or .changed

Dude, no it doesn’t.
It’s not lag, it’s a mathematical inaccuracy, please only reply further if you actually can give me something to work with.