GetMass (Function): Difference between revisions

From Goodblox Wiki
Jump to navigationJump to search
(created the page)
 
 
Line 14: Line 14:
<pre>
<pre>
local myPart = Instance.new("Part")
local myPart = Instance.new("Part")
myPart.Parent = workspace
myPart.Size = Vector3.new(4, 6, 4)
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
myPart.Anchored = true
myPart.Parent = workspace


local myMass = myPart:GetMass()
local myMass = myPart:GetMass()

Latest revision as of 23:46, 23 September 2021

Function
Syntax GetMass( )
Returns Number object mass
Description: Returns the Number of the object's mass.
In Object: BasePart


Description

The GetMass function returns a Number value of the object's mass. Currently, all objects in GoodBlox have a density of 1, which means the GetMass returns the same value as the Volume of the object (size x * size y * size z*). This can be useful to determine more than just the mass of an object, but also the size.

Example

local myPart = Instance.new("Part")
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
myPart.Parent = workspace

local myMass = myPart:GetMass()

print("My part's mass is "..myMass) --> My part's mass is 96