The title basically says it all
local localPos = Vector3.new(x, y, z)
local worldPos = cframe:PointToWorldSpace(localPos)
block.Position = worldPos
x,y,z is the position of the mouse snapped to the grid
and cframe is the cframe of the canvas
(this does use raycast)