Dragging slots in UIGridLayout inventory

Hello, currently I’m making inventory system. Technically I already know how to make it, but right now I confused with dragging effect. So in my very old prototype:


Here I used dragging module, with replacing old position temporary slot. But, I can’t use that module with UIGridLayout. So, how to make some GuiObject attached to my cursor when I dragging some item. How it looks right now:

The way I did it in my test game was by creating this function:

local function updateInput(input, cmdToMove)
	local cmd = cmdToMove
	local delta = input.Position - dragStart
	local postion = UDim2.new(startPostion.X.Scale, startPostion.X.Offset + delta.X,
		startPostion.Y.Scale, startPostion.Y.Offset + delta.Y)
	TweenService:Create(cmd, TweenInfo.new(dragSpeed), {Position = postion}):Play()
end

Then I call it later in my script when the mouse moves:

UserInputService.InputChanged:Connect(function(input)
					if input.UserInputType == Enum.UserInputType.MouseMovement then
						if dragToggle.Value then
							updateInput(input, newCmdWhenClicked)
						end
					end
				end)

Here is the game in action: Script your own items test - Roblox

Disclaimer: This code was partially or fully AI-generated from: https://chat.openai.com/chat

Here’s an idea: When the user drags an item, parent it outside the grid, and hook mousemove to set the position of the item to your mouse. Then, when the user lets go of click, you can place it back in.

i tried already before. But firstly its just teleporting somewhere, it will be reay laggy. I iwllt ry just create item frame which will attach on my cursor

Ah, do you want it to smoothly move into your cursor?

Its really doesnt matter too much, I just need it have some dragging effect.