Need help with this placement issue using in my drawing canvas

Hey,
So I’m trying to create a drawing canvas using a SurfaceGui. I’ve made the whole system and it works fine except when I use the drawing function for recursion, aka calling itself. Any point that I place without calling the function from itself seems to be placed correctly, however you’re supposed to draw while still holding your mouse so I used the recursion method. Now, when that happens, I don’t know why but my point gets placed on the top left corner of my canvas. How could I fix this issue?

I used the GetMouse().X and GetMouse().Y to get the player’s mouse position and placed the point using UDim2.new(0, mouse.X, 0, mouse.Y) which seems to be working fine for the first point as I mentioned.

like why
image

2 Likes

Can’t help if you don’t post code :upside_down_face:

Using recursing to make this is an interesting idea and not what I’d have gone with. It can definitely work, but you might want to look up tail recursion and how Roblox Lua handles recursion (not the same as Lua 5.1), at least if you’re doing very deep recursion.