How to get bottom (floor) of a model

Ive been making a stamper tool model easier to use. A problem that occurs that there needs to be a Primary part on the floor for the model not to clip through any ground (primary part follows the cursor, as well as model).

example on what needs to happen
image_2023-05-12_175550811

I know how to use :GetExtentSize(), but not how to get the bottom of a model.

What I’m asking is that if anyone knows how to get the bottom of a model.

Can someone help me? Thanks!

Try doing something like this:

local bottom = 9e5 -- Can be the highest point of your map or whatever.
for i, v in pairs(model:GetDescendants()) do
    if v:IsA('BasePart') then -- Check if Instance is a part
        local curr = v.Position.Y-v.Size.Y/2 -- Gets the bottom of the part
        if curr < bottom then -- Check if its the lowest point from every checked part
            bottom = curr -- Make it the lowest point
        end
    end
end
1 Like

This gets the bottom of a primary part, as I can see. Does this work for a model?

Its designed for a model, it goes through every part and gets it’s lowest point.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.