For some reason, this does not work…I print the position of it and it says it updates but the actual UI does not actually move. The Item is a button, and inside the button is a few extra components. Another thing to note is that it is inside of a UI Grid layout. Here is code:
function Utility.DragItem(Item, ConnectionManager)
print(Item)
local InitialPos = Item.Position
if not Dragging then
Dragging = true
print("Drag")
local ConnectRunService = RunService.Heartbeat:Connect(function(deltaTime)
local MousePos = UserInputService:GetMouseLocation()
Item.Position = UDim2.new(0,MousePos.X,0,MousePos.Y)
print(Item.Position)
end)
ConnectionManager:AddConnection("ItemDragConnection", ConnectRunService)
else
print("StopDrag")
Dragging = false
Item.Position = UDim2.new(InitialPos)
ConnectionManager:Remove("ItemDragConnection")
end
end