Placement system

hello everyone, i am making a tycoon with placement system but i have a problem with the grid.

currently i am using:
newCframe = CFrame.new(math.floor(mouse.Hit.X / TILE +.5) * TILE, math.floor(mouse.Hit.Y / 5 +.5) * 5, math.floor(mouse.Hit.Z / TILE +.5) * TILE) * CFrame.Angles(0,math.rad(ROT),0)

and then i tween the models primarypart to “newCFrame”

its works fine if the model that needs to be placed is the size of TILE wich is 3.5 studs.
but i want to be able to place walls with a difrent grid of 7 but it stil needs to be aligned to the grid of TILE,
since ive never been good at math i cant find a solution for this.

this is what currently happens:

What i want to happen:

thnx for helping me out! :smiley: