guiScrollBarGetScrollPosition | Multi Theft Auto: Wiki Skip to content

guiScrollBarGetScrollPosition

Client-side
Server-side
Shared

Pair: guiScrollBarSetScrollPosition

This function gets the scroll amount of a scrollbar as a percentage.

OOP Syntax Help! I don't understand this!

  • Method:gui-scrollbar:getScrollPosition(...)
  • Variable: .scrollPosition

Syntax

float|false guiScrollBarGetScrollPosition ( ​gui-scrollbar theScrollBar )
Required arguments
  • theScrollBar: The scrollbar you want to check.

Returns

Returns a float ranging between 0 and 100, representing the amount the scrollbar has been scrolled, false if invalid scrollbar element was passed.

  • float|false: scroll position

Code Examples

client

This example outputs a message with the new scroll position when a scrollbar is scrolled.

function OnScroll()
outputChatBox("The new scroll position is " ..guiScrollBarGetScrollPosition(source))
end
addEventHandler("onClientGUIScroll", root, OnScroll)

See Also

GUI Functions