Will this code work to make block sizes whole numbers?

I am adapting some code that was used to change the color of certain parts if they were a certain color. What I want this code to do is look through all of the parts in the game, and if their color is “Lily white” and material is “Plastic”, the size of the parts in ever dimension will be rounded down to the floor integer.

For example, if a block has size (24.5, 21.2, 59.9), the new size will be (24, 21, 59), only if it is Lily white and Plastic. Will the below code work for this purpose?

for i, v in pairs(workspace:GetDescendants()) do
  if v:IsA("BasePart") then
    if v.BrickColor == BrickColor.new("Lily white") and v.Material == Material.new("Plastic") then
    v.Size = Vector3.new(math.floor(v.Size.X),math.floor(v.Size.Y),math.floor(v.Size.Z))
  end
end end

I greatly appreciate any help.

Ever tried running the code before actually posting?

External Media
2 Likes