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

Finding a Part's Mass

Finding a Part's Mass

Sep 17 2018, 4:45 PM PST

This example creates a new part, myPart, in the game’s Workspace, with dimensions 4x6x4 studs. The part is also anchored.

Then, myMass is set to equal the mass of the new part. The mass of the part is printed at the end of the print statement:

My part’s mass is …

local myPart = Instance.new("Part")
myPart.Parent = game.Workspace
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
 
local myMass = myPart:GetMass()
 
print("My part's mass is " .. myMass)