Hello, i’m trying to create a organizable inventory, for this i need to drag items in inventory and i don’t know how to do this.
I searched in dev forum but all topics i found had as solution using model scripts since draggable property got deprecated, but i want to drag items with my own code.
What i need is an idea of how to set the position of a gui that’s parented to a frame with UIGridLayout to mouse position.
You could make the item draggable. Once the player releases the mousebutton the script checks whether the gui position is inside the inventory space. If the position is inside the inventory space it makes the gui the child of the inventory and the UIGridLayout will sort the inventory.
Hope this is what you mean.
Thank you it worked!! I didn’t needed to resize the item
Edit:
How would i make this? Because i can’t subtract the itemframe.Parent.Position because it’s parent is an screen gui and if i subtract the old itemframe parent position the item goes like 500 pixels to left of my mouse.
How would i make this? Because i can’t subtract the itemframe.Parent.Position because it’s parent is an screen gui and if i subtract the old itemframe parent position the item goes like 500 pixels to left of my mouse.
What I meant is, if you do not want the item to be dragged outside of the window, you need to recalculate position WITHOUT parenting the item to the ScreenGui. This is because items in the window are positioned relative to the window itself, and not the whole screen. By subtracting the window position, you can drag items without parenting them to the main screen.~
This way item will “disappear” when taken outside of window boundaries, provided ClipsDescendants property is set. Also make sure window AnchorPoint is set to 0,0; otherwise when recalculating the position you will have to take the window size into account.