Painting script inverses Y axis

Hello, I am trying to make a script that paints on a canvas (part) using dots (imagelabels), but when I try it, the X axis works, but the Y axis seems to be inverted

local HitPos = Mouse.Hit.Position

local X = HitPos.X - (Canvas.Position.X - Canvas.Size.X/2)
local Y = HitPos.Y - (Canvas.Position.Y - Canvas.Size.Y/2)

local Dot = Canvas.ImageLabel:Clone()

Dot.Position = UDim2.new(0, X * PixelsPerStud, 0, Y * PixelsPerStud)

This is the part of the script which calculates the position of the dot
Please help, thanks!

With the position of a part in 3D space, increasing the y component leads to a higher position. GUIs use a 2D position with the origin in the top left corner - increasing the y component will give you a lower position. Can you just invert your y coordinate?

1 Like

I thought it was because I was doing something wrong with calculating the Y, I inverted the position and now it works, thanks!