Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I detect if someone is scrolling in a scrolling frame?

I have a custom drag script, but whenever I click on the scroller in a scroll frame to scroll up, it also drags the whole GUI. Any way to detect this and not drag if the user clicks on the scroller?

1 answer

✓ Accepted answer

Store the ScrollFrames previous CanvasPosition in a Vector2 variable and compare it to it's current. If it's different from it then the player is scrolling.

--LocalScript
local prevPosition = Vector2.new()
local scrollFrame = script.Parent
prevPosition = scrollFrame.CanvasPosition

local runService = game:GetService("RunService")

function checkPos()
	if (prevPosition-scrollFrame.CanvasPosition).magnitude > 0 then
		--Do whatever
	end
	prevPosition = scrollFrame.CanvasPosition
end

runService:BindToRenderStep("checkPos",0,checkPos)

This discussion is preserved as it was. New answers, comments, and votes are closed.