If so, it’s not a very good option. Who on earth in a game would know to do this? If we’re only intending to scroll on the X axis, I believe it should just default to that behavior.
Hi @NinjoOnline - thank you for reporting this issue! Horizontal scrolling is one of the items we’re looking to improve along with other changes to ScrollingFrame. It’s good to know that devs are requesting this functionality as it helps us prioritize our backlog!
I rely pretty heavily on horizontal scrolling in my game and I realized it didn’t seem to be properly supported a while ago, but if you need it for yours this is the solution I came up with:
function interfaceService:setupHorizontalScrolling(scrollingFrame)
local connections = {}
local position = scrollingFrame.CanvasPosition
local function verify()
local pos = userInputService:GetMouseLocation()
local objects = engine.playerGui:GetGuiObjectsAtPosition(pos.X, pos.Y)
if table.find(objects, scrollingFrame) then
return true
end
end
table.insert(connections, userInputService.InputChanged:Connect(function(io)
if not verify() then return end
if io.UserInputType == Enum.UserInputType.MouseWheel then
local diff = scrollingFrame.CanvasSize.X.Offset - scrollingFrame.AbsoluteSize.X
diff = math.clamp(diff, 0, diff > 0 and diff or 0)
position = position + Vector2.new(50 * io.Position.Z, 0)
local x = position.X
position = Vector2.new(math.clamp(position.X, 0, diff), 0)
tweenService:Create(scrollingFrame, TweenInfo.new(0.2), {CanvasPosition = position}):Play()
end
end))
return connections