Need some help with UI

I have this snippet of which controls the movement of the UI.

		if not CS:HasTag(CurrentItem, "UI") then
			CurrentItem.Position = UDim2.fromScale(X,Y) --UDim2.fromOffset(Mouse.X - 75,Mouse.Y - 50)
			CurrentItem.Size = UDim2.fromOffset(XS,YS) 
			CurrentItem.Parent = PlayerGui.Display
		else
			
			CurrentItem.Position = UDim2.fromScale(X,Y)--UDim2.fromOffset(Mouse.X  -300,Mouse.Y - 50)
		end

My problem lies in the actual scaling of the screen depending on the screen size. The mouse is never directly over the item they are dragging, as well as it snaps ImageLabels that they can drag.

Videos:

I have spent quite a bit of time debugging this, as well as a check-in in with Hidden Developers and Lua learning to no avail.

Any help would be greatly appreciated.

1 Like

Is the anchor point set to 0.5,0.5? I know it seems basic…

4 Likes

No, they are all 0,0. Will changing them to .5 change anything?

Yes, they will mark the center point at the center. Not at the top left

Did it work by any chance maybe???

1 Like

Sorry, I had to step away for class. I will test it out in a little bit.

Amazing, thank you for your assistance. I don’t mainly do UI; I mostly develop backend systems so this was outside of my comfort zone.

Appreciate it,

samjay22

1 Like

0.5,0.5 is center of screen right?

1 Like