local mbd = false --mb1 = Mouse Button Down for i,v in pairs(script.Parent.Inventory) do v.ImageButton.MouseButton1Down:connect(function() mbd = true v.Draggable = true end) v.ImageButton.MouseButton1Up:connect(function() mbd = false v.Draggable = false end) end
I am trying to make a drag/drop inventory system, but once I started coding it, I realized I have no clue on how to do it exactly. I want to make it so when the player clicks and holds on the slot it can be dragged and when dropped, if hovered above another slot it will replace the slot otherwise it returns to the previous slot spot. How can I do this?
You can use Drag Stopped: http://wiki.roblox.com/index.php?title=API:Class/GuiObject/DragStopped And you can use 2D Collision Detection: http://wiki.roblox.com/index.php?title=2D_Collision_Detection