I am making it so that a button can be dragged into different frames. I am stuck on the last part, wondering how to reference the right frame. I thought of using return, but I don't know how. Suggestions anyone?
game:GetService("UserInputService").InputEnded:Connect(function(KeyCode) if KeyCode.UserInputType == Enum.UserInputType.MouseButton1 then if Dragging == true then Dragging = false local FrameList = {Holder.ButtonHolder1, Holder.ButtonHolder2, Holder.ButtonHolder3} for i, frame in pairs(script.Parent.ButtonHolder:GetChildren()) do local Distance = (frame.AbsolutePosition - Image.AbsolutePosition).Magnitude table.insert(FrameList,Distance) wait(0.1) end print(FrameList[1]) print(FrameList[2]) print(FrameList[3]) table.sort(FrameList) local ClosestFrame = FrameList[1] --Image.Position = Frame[1].Position end end end)