So i’m making a placement system and i’m welding the part i’m placing to every part it’s touching with this code:
local touching = placedPart:GetTouchingParts()
if touching and #touching > 0 then
for _,part in pairs(touching) do
if not table.find(plr.Character:GetChildren(),part) then
local weld = Instance.new("WeldConstraint")
weld.Parent = placedPart
weld.Part0 = placedPart
weld.Part1 = part
end
end
end
However in the placing script, when the part i’m placing isn’t rotated it is placed “against” the wall but is not touching it so it doesn’t weld. How do i make :GetTouchingParts (or some other function) get the parts touching a slightly larger area (like 0.001 studs on all sides) so it also gets the parts the placing part is placed against?
So in the script i would make a new part named hitbox that has the same CFrame as the part i’m placing but a slightly larger size, then check for touching parts of hitbox and then destroy hitbox?
yes. depending on how often you need to do checks it may be more beneficial to not delete the hitbox. Also, for more specific customization you can manually size the hitbox in studio and then you don’t have to create it through a script.