Thank You For your time and afford hi, I have a problem I made a script that when a player clicks a Part is Created where the mouse position clicked but I want to have a structure like Minecraft when I create a part next to apart it's not crooked it's exactly next to it here is the script for creating the part and
local part=Instance.new("Part") part.Parent=script.Parent:WaitForChild("Craft") local clickdetector=Instance.new("ClickDetector") local scriptfordestroy=rightclickscript:Clone() clickdetector.Parent=part scriptfordestroy.Parent=clickdetector part.Anchored=false part.CFrame=CFrame.new(mouseposx,mouseposy+1,mouseposz) part.Rotation = Vector3.new(0,0,0) part.Size=Vector3.new(2.2,2.2,2.2) part.BrickColor=BrickColor.new(brickcolor)
here is what i mean when i want to create it https://pasteboard.co/J6bknzS.png
If you want to the cubes to stick to each other like a grid, then you want to take each axis and convert to a new value before applying to the part. math.floor(axis / cubeSize) * cubeSize
local part=Instance.new("Part") local cubeSize = 2.2 function convert(axis) return math.floor(axis / cubeSize) * cubeSize end local clickdetector=Instance.new("ClickDetector",part) local scriptfordestroy=rightclickscript:Clone() local x,y,z = convert(mouseposx), convert(mouseposy), convert(mouseposz) scriptfordestroy.Parent=clickdetector part.Anchored=false part.CFrame=CFrame.new(x,y,z) part.Rotation = Vector3.new(0,0,0) part.Size=Vector3.new(cubeSize,cubeSize,cubeSize) part.BrickColor=BrickColor.new(brickcolor) part.Parent = script.Parent:WaitForChild("Craft")