Well I want to make a scrolling frame draggable without the Draggable feature to move the frames without using scrolling or clicking the scroll button of the ScrollingFrame.
In the following video is the Draggable function, but I want to change it to something similar in ScrollingFrame.
No, I mean I want to make the scrolling of the ScrollingFrame usable as Draggable.
Edit: What I want to do is that it can be moved from the Frame of the ScrollingFrame using the Scrolling like the Draggable, but I don’t know how to do it.
local UIS = game:GetService("UserInputService")
local scrollingFrame = script.Parent
local initPos = nil
local scrollSens = 1
scrollingFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
initPos = input.Position
end
end)
scrollingFrame.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
if not initPos then return end
if not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then return end
local yChange = input.Position.Y - initPos.Y
scrollingFrame.CanvasPosition = scrollingFrame.CanvasPosition + Vector2.new(0,yChange * scrollSens)
initPos = input.Position
end
end)
Try this in a localscript under the scrolling frame. You can increase the scrollSens variable for sensitivity.
local UIS = game:GetService("UserInputService")
local scrollingFrame = script.Parent
local initPos = nil
local scrollSens = 1.3
scrollingFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
initPos = input.Position
end
end)
scrollingFrame.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
if not initPos then return end
if not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then return end
local yChange = input.Position.Y - initPos.Y
local xChange = input.Position.X - initPos.X
scrollingFrame.CanvasPosition = scrollingFrame.CanvasPosition + Vector2.new(xChange * scrollSens ,yChange * scrollSens)
initPos = input.Position
end
end)