PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Size

BasePart

Vector3

The Size property determines the dimensions of a part. The individual dimensions can go as low as 0.05 and as high as 2048 (or 2^11). The size of the part is used in determining its mass, which is given by /BasePart/GetMass. The /BasePart/Shape of a part can apply some restrictions on Size - namely, a Ball must have the same 3 dimensions. A part’s Size is used by a variety of other objects:

  • /ParticleEmitter uses Size to determine the area from which particles are spawned.
  • /BlockMesh uses Size to partially determine the rendered rectangular prism.
  • /SpecialMesh uses Size for some certain /SpecialMesh/MeshTypes to determine the size of the rendered mesh.
  • /SurfaceLight uses Size to determine the space to illuminate.

Code Samples


Pyramid Builder

This code sample constructs a pyramid by stacking parts that get progressively smaller. It also colors the parts so they blend between a start color and end color.

-- Configuration of the tower
local pos = Vector3.new(50, 50, 50)
local towerBaseSize = 30

-- Decide on two colors that are different in hue
local hue = math.random()
local color0 = Color3.fromHSV(hue, 1, 1)
local color1 = Color3.fromHSV((hue + .35) % 1, 1, 1)

-- Create a model to hold tower parts
local model = Instance.new("Model")
model.Name = "Tower"
for i = towerBaseSize, 1, -2 do
	-- Create a part
	local part = Instance.new("Part")
	part.Parent = model
	part.Size = Vector3.new(i, 2, i)
	part.Position = pos
	part.Anchored = true
	-- Tween from color0 and color1
	local perc = i / towerBaseSize 
	part.Color = Color3.new(
		color0.r * perc + color1.r * (1 - perc),
		color0.g * perc + color1.g * (1 - perc),
		color0.b * perc + color1.b * (1 - perc)
	)
	-- Move up
	pos = pos + Vector3.new(0, part.Size.Y, 0)
end
model.Parent = workspace