Centering the GUI to the player's mouse while using the UIDragDetector

  1. What do you want to achieve? Keep it simple and clear!
    I am using the UIDragDetector, and I want to make it so when the player clicks, (and the GUI enters drag mode) the GUI centers to the player’s mouse.

  2. What is the issue? Include screenshots / videos if possible!
    I can’t simply manipulate the position of the GUI after the drag begins, and I can’t find any other solution.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried making a simple script where when the drag starts, the position snaps to the mouse position.

I can’t find any good property that I could manipulate to achieve my goal. If anyone has any idea/solution, please share it with me. Thank you very much!

I would recommend just making your own custom system using button.MouseButton1Down, UIS.InputChanged, and button.MouseButton1Up. You could have an offset that is half the size of the ui object and subtract that from the mouse position in the UIS.InputBegan function.

I’ll try that, thank you! I was only thinking about the Roblox “built-in” one but I guess I don’t have to be restricted to that.