I have a 4x4 grid building script. Whenever i try to place a block by the side of another block, the block instead just goes into the other block.
I recommend testing this and building with it for a while to understand what I am talking about.
db = true
local tool = script.Parent
local me = game.Players.LocalPlayer
local mouse = me:GetMouse()
tool.Activated:connect(function()
if db then
db = false
print("placed brick")
local part = game.ReplicatedStorage.Dirt:Clone()
part.Parent = workspace
local offsety = 2
local a = mouse.Hit -- point a
local x = a.X
local y = a.Y
local z = a.Z
local x = math.floor(x / 4) * 4
local y = math.floor(y / 4) * 4
local z = math.floor(z / 4) * 4
c = CFrame.new(x,y,z) + Vector3.new(2,offsety,2)
print(c)
part.CFrame = c
wait(.2)
db = true
end
end)
"Dirt" is a 4x4 part. db is the cooldown for placing blocks
edit: here's a demonstration of what i am talking about https://youtu.be/sGb2sb4mclo

7 comments
this is very odd, but upon adding my variables and testing the script i get this error 15:58:30.344 - Players.bartekrabit.Backpack.Dirt.Script:22: bad argument #1 to 'new' (Vector3 expected, got CFrame) (line 13 in your script) it's odd because it's cframe.new not vector3.new
You can't pass a CFrame to CFrame.new(). Just remove the outter CFrame.new() part and leave the 'mouseTarget.CFrame' portion.
there's a big issue with this script. it only gets the CFrame of the part and places a block 2,2,2 away
Sorry, I made the script in a hurry. @ScrewDeath you're right about that, fixed it.
@bartekrabit I'm not sure what your goal is, which is why that may occur. So you are trying to place a new block (2, 2, 2) away from the dirt?
try the script yourself and you'll see excatly what is my idea.
Ah okay. So I tried out the script, but I don't see a problem with it: https://i.gyazo.com/58bacc5e04473758dba6ed6d8eeb24a4.mp4