UI not going where it should

I am making a drawing system and to place the circle from drawing I am trying to place where the user’s mouse icon is but it doesn’t seem to place correctly (shown below)

https://gyazo.com/658e24cc056b0558dcc177f9faf21b56

I am assigning position like this:

DrawCircle.Position = BrushCricleDecal.Position

Thanks in advance, I can provide more detail if needed.

1 Like

First of all. Show your script. We don’t know what the brush circle is

Brush Circle is the mouse icon UI

It’s really hard to help with how vague you’re being. Do

DrawCircle.Position = Mouse.Position

Also can you not be vague

Sorry, about not giving detail, this is a drawing system inside of UI brush circle is the UI using as an icon, draw circle is the circle I am placing as the drawing piece

It’s fine. If that doesn’t work try:

DrawCircle.Position.X = Mouse.X
DrawCircle.Position.Y = Mouse.Y

Just from looking at the gif, it seems like it’s because you’re reading the mouse position x and y from the top left corner of the screen, then it offsets it by that much in the UI, so instead of going from the corner of your frame you’re drawing on, it goes to the corner of the screen.

“X cannot be assigned to” is the error I get

How can I fix this I can’t seem to figure anything out

You’ll notice that if you scale the drawing frame GUI to the screen size this should fix your issue. But to fix it as is just subtract the picture frame GUI position to the BrushCricleDecal position and multiply it by the picture frame’s total size.

The easiest way is to just subtract the AbsoluteDistance of your UI from your mouse X and Y.

--Your code to get your mouse X and Y
DrawCircle.Position.X = Mouse.X - frame.AbsolutePosition.X
DrawCircle.Position.Y = Mouse.Y - frame.AbsolutePosition.Y