pug6_4
(pug64)
#1
Hello, tried making a custom scrollbar and i got a pretty good product eventually,
but…
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(Vector2.new(0,(script.Parent.AbsoluteCanvasSize.Y - script.Parent.AbsoluteWindowSize.Y)*Product),0.3)
Any help is appreciated :))
1 Like
Qinrir
(Quin)
#2
i dont see any inaccuracy mind telling where
pug6_4
(pug64)
#3
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
Qinrir
(Quin)
#4
so i did make a simple formula to do so
local mouse = --mouse
local ui = -- ui
local ypos = mouse.Y -ui.AbsoluteSize.Y
pug6_4
(pug64)
#5
I’m already doing it this way (charrssss
Qinrir
(Quin)
#6
then remove the lerp and use tween (WAIT NVM i am wrong)
pug6_4
(pug64)
#7
That doesn’t change anything, they’ll do the exact same thing.
Qinrir
(Quin)
#8
yea i legit have no clue whatsoever
let me dig in more
Qinrir
(Quin)
#9
yea i have no clue what so ever can u send me the entire script?
pug6_4
(pug64)
#10
The entire script is just render stepped and checking if the mouse is clicked down, you won’t need it.
Qinrir
(Quin)
#11
render stepped may cause that lag use .moved or .changed
pug6_4
(pug64)
#12
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.