Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making a drag/drop inventory?

Asked by 7 years ago
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?

0
Draggable is deprecated. xXprohax0r1337Xx 74 — 5y

1 answer

Log in to vote
0
Answered by 7 years ago

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

Ad

Answer this question