I have recently been working on a building/stamper tool for a plot building game, and I’ve encountered an issue I’m not sure I can overcome. I am relatively new to making these types of things (building tools), and I’d like for some help & suggestions to be thrown at me so I can overcome these issues and get the ball rolling again.
The issue I’ve been encountering is the building tool not latching onto the blocks in front of you, or if you are on the right side of the block facing in front of it. Forgive my wording of the phenomenon, as it is a bit complicated for me to explain. Anyways, basically if you go on either one of these sides, it’ll just force you to place a new block inside of the pre-existing one.
Here is the LocalScript for it (currently client-sided only):
-- define vars
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local block = game.ReplicatedStorage:WaitForChild("Blocks").Part
local ghostBlock = block:Clone()
ghostBlock.Parent = game.Workspace
ghostBlock.Transparency = .3
ghostBlock.CanCollide = false
ghostBlock.Color = Color3.new(0.309804, 0.529412, 1)
mouse.TargetFilter = ghostBlock
local studs = 4
-- finding block position
mouse.Move:Connect(function()
local mousePos = mouse.Hit.Position
local blockPos = Vector3.new(0, block.Size.Y / 2, 0)
blockPos += mousePos
local xPos = math.round(blockPos.X / studs) * studs
local yPos = math.round(blockPos.Y / studs) * studs
local zPos = math.round(blockPos.Z / studs) * studs
blockPos = Vector3.new(xPos, yPos, zPos)
ghostBlock.Position = blockPos
end)
-- placing blocks
mouse.Button1Down:Connect(function()
local placedBlock = block:Clone()
placedBlock.Parent = game.Workspace
placedBlock.Position = ghostBlock.Position
placedBlock.CanCollide = true
end)
Any help whatsoever would be appreciated!

