Ideas on how to fill a part with attachments? (0.1 studs away from one another)

Hello, I wanna have an idea on how I can achieve this through scripting:
image
I think I’m gonna have to use loops and vector math but I have zero idea on how to execute it. I’m planning to use swordphin’s raycast hitbox system BTW.

I Think lerping is one of the ways of doing this? sadly i’m also not that well versed when it comes to math, but i found a similar thread to this

Attachment.Position is relative to the cframe of its parent part, so this is pretty simple. I think this code should work.

local part = -- the part
local halfSize = part.Size/2

for x = -halfSize.X, halfSize.x, .1 do
    for y = -halfSize.Y, halfSize.Y, .1 do
        for z = -halfSize.Z, halfSize.Z, .1 do
            local attach = Instance.new("Attachment")
            attach.Position = Vector3.new(x, y, z)
            attach.Parent = part
        end
    end
end
3 Likes

Thanks man! I didn’t realize it was that simple. :sweat_smile: