We use cookies on this site to enhance your user experience
Collapse Sidebar


The WheelForward event fires when a user scrolls their mouse wheel forward when the mouse is over a GuiObject|GUI element. It is similar to Mouse/WheelForward, which fires regardless whether the user’s mouse is over a GUI element.

This event fires merely as an indicator of the wheel’s forward movement. This means that the x and y mouse coordinate arguments do not change as a result of this event. These coordinates only change when the mouse moves, which can be tracked by the GuiObject/MouseMoved event.

See also

  • GuiObject/MouseEnter
  • GuiObject/MouseLeave
  • GuiObject/MouseMoved
  • GuiObject/MouseWheelBackward


Name Type Default Description



The mouse’s x screen coordinate in pixels, relative to the top left corner of the screen



The y coordinate of the user’s mouse

Code Samples

Custom Scrolling GUI

The example below creates a custom scrolling frame using a Frame to mimic a ScrollingFrame using the GuiObject/MouseWheelForward and GuiObject/MouseWheelBackward.

The example works by moving a Frame that is the child of our CustomScrollingFrame and parent to the TextBox|TextBoxes. Thus, we use a Frame to act as a container for the GUI elements we want to scroll. The script adjust’s the DataType/UDim2 Y scale position of the Frame between 0 and -1 when the user scroll’s their mouse forward and backward to mimic the scrolling of a traditional ScrollingFrame element.

Although this is a simple application of the MouseWheel events, it can be expanded upon for more complex GuiObject|GUI layouts and interaction such as custom ScrollingFrames that scroll at different rates or with different elasticity.

The gif below demonstrates the expected functionality of the code based on the GUI layout also shown below.

Code sample demonstration

GUI Layout in Studio Explorer Window

local CustomScrollingFrame = script.Parent
local SubFrame = CustomScrollingFrame:FindFirstChild("SubFrame")

function scrollUp(x, y)
	if SubFrame.Position.Y.Scale < 0  then
		SubFrame.Position = SubFrame.Position + UDim2.new(0, 0, .015, 0)
	elseif SubFrame.Position.Y.Scale > 0 then
		SubFrame.Position = UDim2.new(SubFrame.Position.X.Scale, 
			SubFrame.Position.X.Offset, 0, SubFrame.Position.Y.Offset)

function scrollDown(x, y)
	if SubFrame.Position.Y.Scale > -1 then
		SubFrame.Position = SubFrame.Position - UDim2.new(0, 0, .015, 0)
	elseif SubFrame.Position.Y.Scale < -1 then
		SubFrame.Position = UDim2.new(SubFrame.Position.X.Scale, 
			SubFrame.Position.X.Offset, -1, SubFrame.Position.Y.Offset)