Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bar = script.Parent
- local scroller = script.Parent.ImageButton
- local increment = 1
- local last_mousebutton1downpos Vector2.new(0,0);
- local mouse = Game.Players.LocalPlayer:GetMouse();
- local scrollerHeight = bar.AbsoluteSize.Y/script.Parent.Parent.SCROLL.AbsoluteSize.Y;
- function GetScrollerClicked(mousex, mousey)
- local x,y = mousex, mousey
- local posx,posy,sizex,sizey = scroller.AbsolutePosition.X, scroller.AbsolutePosition.Y, scroller.AbsoluteSize.X, scroller.AbsoluteSize.Y;
- if ( (x >= posx) and (x <= posx+sizex) ) and ( (y >= posy) and (y <= posy+sizey) ) then
- return true
- end
- end
- function MousePassesDelta(mousex, mousey)
- local Y_factor = 1;
- local lasty = last_mousebutton1downpos.Y
- local passedy = false;
- local negativey = false;
- if mousey > lasty then
- if (mousey - lasty) >= increment then
- passedy = true;
- Y_factor = math.floor((mousey - lasty)/increment)
- end
- else
- negativey = true;
- if (lasty - mousey) >= increment then
- passedy = true;
- Y_factor = math.floor((lasty - mousey)/increment);
- end
- end
- return passedy, negativey, Y_factor;
- end
- mouse.Button1Down:connect(function()
- if GetScrollerClicked(mouse.X, mouse.Y) then
- last_mousebutton1downpos = Vector2.new(mouse.X, mouse.Y);
- mosemouve_connection = mouse.Move:connect(function()
- end)
- end
- end)
- mouse.Button1Up:connect(function()
- pcall(function()
- mousemove_connection:disconnect();
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement