Frame not moving correctly with a Inventory System

Hello, I’m trying to make an inventory system. I made the system move the item and drop but the frame is not in the same position as my mouse. Can anyone help?

Code i used:

Image.Position =, Mouse.X, 0, Mouse.Y)
1 Like

I’m gonna take a guess and assume your issue is because you aren’t taking into account the offset from GuiInset at the top of the screen. There’s a simple way you can get the true position like this:

local GuiService = game:GetService("GuiService")
local offset = GuiService:GetGuiInset()
local mousePosition =, Mouse.Y) -,offset.Y)

Hope this helps! If you have any questions feel free to ask.

1 Like
local Frame : Frame = script.Parent

local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()

local UIS = game:GetService("UserInputService")

local IsInside
local X,Y = 0,0

Frame.MouseEnter:Connect(function() IsInside = true end)
Frame.MouseEnter:Connect(function() IsInside = false end)

	X,Y = Mouse.X - Frame.AbsolutePosition.X,Mouse.Y - Frame.AbsolutePosition.Y

	if IsInside and UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then Frame.Position =,Mouse.X - X,0,Mouse.Y - Y) end

or you just can use this module