Hello!
I want to make a build tool to build anything. Basically, my tool works well... However, the blocks that I want to put doesn't appear on the sides of other blocks. Exactly, when I hover the mouse, for example, on the side of a pillar, then when I press the left mouse button, the block appears on pillar's top, and not where my mouse is or not on the side of the pillar.
Here's my localscript inside my tool:
--- Services ---
local rs = game:GetService("ReplicatedStorage")
--- Modules ---
local BlockModule = require(rs.BlockModule)
local ImageModule = require(rs.ImageModule)
local WeldModule = require(rs.WeldModule)
--- Variables ---
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
local function round(number,increment)
number = math.floor(number)
number = number-(number%increment)
return number
end
--- Actual Code ---
tool.Equipped:Connect(function()
local placement = rs.Blocks:FindFirstChild("Part"):Clone()
placement.Anchored = true
placement.Transparency = 0.5
placement.CanTouch = false
mouse.TargetFilter = placement
placementmodel = Instance.new("Model",workspace)
placementmodel.Name = player.Name.."'s placement"
placement.Parent = placementmodel
placementmodel.PrimaryPart = placement
movePlacement = game:GetService("RunService").Stepped:Connect(function() -- it makes placement of selected block follow player's mouse
placementmodel:MoveTo(Vector3.new(round(mouse.Hit.Position.X,1),round(mouse.Hit.Position.Y,1),round(mouse.Hit.Position.Z,1)))
end)
onMouseClick = mouse.Button1Down:Connect(function()
rs.Place:FireServer("Part", placementmodel.PrimaryPart.Position)
end)
end)
tool.Unequipped:Connect(function()
onMouseClick:Disconnect()
movePlacement:Disconnect()
placementmodel:Destroy()
end)
I hope I explained my problem clearly.

1 comment
Thanks for the help, now the block can really be located on the sides of other blocks! But now I have the following problem: when the mouse hovers over some block, placement falls into it by half but CanCollide property of placement is true. I think it happened because of my understatement in this topic. Is there any solution to problem that causes placement to penetrate into other blocks by half?