Hello! With my attempts at making a drag and drop GUI frame, I’ve had some issues, primarily this one.
My goal is to have a drag and drop frame, but while it works inside of static objects (Like a normal frame) it completely breaks inside of a scrolling frame.
It seems like when I scroll the GUI the positions become horribly offset, completely ruining the ‘drag’ effect.
My code (The function that handles the dragging.)
--// Services local userInputService = game:GetService("UserInputService") local guiService = game:GetService("GuiService") --// Values local topbarInset = guiService:GetGuiInset() function drag(frameToDrag) local absolutePosition = userInputService:GetMouseLocation() local relativePosition = absolutePosition - frameToDrag.Parent.AbsolutePosition frameToDrag.Position = UDim2.fromOffset(relativePosition.X, relativePosition.Y - inset.Y) end
(Some of the code was used from a similar devforum post, but I can’t say which.)
Thank you for any help I recieve!