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

Why does GetGuiObjectsAtPosition not work on scrollingframes?

So I have a line of code that collects the ui's that the mouse is hovering over. What it does is it creates a table that contains the ui's it found on the mouse pos. This works when I hover something that isn't inside or is a scrolling frame however when I fire the function while holding over the scrolling frame it returns nil

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local function getuimouse()
	print(mouse.X, mouse.Y)
	return player.PlayerGui:GetGuiObjectsAtPosition(mouse.X, mouse.Y)
end

This gif demonstrates the problem https://gyazo.com/a38b8814965d4decbe9e13446efcf392

2 comments

0

Wait it seems to work but mouse.Button2Down:connect(function() does not fire while hovering over a scrolling frame

0

Alright I instead used userinputservice and the issue is fixed. Mouse events don't work on scrolling frames

1 answer

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		local uis = getuimouse()
	end
end)

Use user-input service it's better and more flexible

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