Functions avaiable in MBScript that return a value. Used in MBScript by: 'Func.Type.Name'

MB Variable

NameTypeDescription
Get VariableMB Variable

Stored Entities Data

NameTypeDescription
New(Entity, Bool)Stored Entities Data
New With Entities(Entity List, Bool)Stored Entities Data

Play Time

NameTypeDescription
TimePlay TimeTime since start of the world's play mode

Range

NameTypeDescription
New(Number, Number)Range
ZeroRange
Zero To OneRange

Color

NameTypeDescription
WhiteColorSolid White
BlackColorSolid Black
CyanColor
ClearColor
GreyColor
GrayColor
MagentaColor
RedColor
YellowColor
GreenColor
BlueColor
Lerp(Color, Color, Number)ColorLinearly interpolates between colors a and b by t
Lerp Unclamped(Color, Color, Number)Color
New(Number, Number, Number, Number)Color
RandomColorGenerates a random color from HSV and alpha ranges

Date Time

NameTypeDescription
NowDate Time
TodayDate Time
Utc NowDate Time
New(Whole Number, Whole Number, Whole Number, Whole Number, Whole Number, Whole Number)Date Time

Mathf

NameTypeDescription
PINumber
InfinityNumber
Negative InfinityNumber
Deg2RadNumberDegrees-to-radians conversion constant
Rad2DegNumberRadians-to-degrees conversion constant
AbsNumberReturns the absolute value
AcosNumberReturns the arc-cosine - the angle in radians whose cosine is f
AsinNumberReturns the arc-sine - the angle in radians whose sine is f.
AtanNumberReturns the arc-tangent - the angle in radians whose tangent is f.
Atan2(Number, Number)NumberReturns the angle in radians whose Tan is y/x.
CeilNumberReturns the smallest integer greater to or equal to f.
Clamp(Number, Number, Number)NumberClamps the given value between a range defined by the given minimum integer and maximum integer values. Returns the given value if it is within min and max.
Clamp01NumberClamps value between 0 and 1
CosNumberReturns the cosine of angle f
Delta Angle(Number, Number)NumberCalculates the shortest difference between two given angles given in degrees
ExpNumberReturns e raised to the specified power.
FloorNumberReturns the largest integer smaller than or equal to f.
Lerp(Number, Number, Number)NumberLinearly interpolates between a and b by t.
Lerp Angle(Number, Number, Number)NumberSame as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
Log(Number, Number)NumberReturns the natural (base e) logarithm of a specified number.
Log10NumberReturns the base 10 logarithm of a specified number.
Max(Number, Number)NumberReturns the largest value.
Min(Number, Number)NumberReturns the smallest of two values.
Move Towards(Number, Number, Number)NumberMoves a value current towards target.
Move Towards Angle(Number, Number, Number)NumberSame as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
Pow(Number, Number)NumberReturns f raised to power p.
SignNumberReturns the sign of f.
SinNumberReturns the sine of angle f.
Smooth Step(Number, Number, Number)NumberInterpolates between min and max with smoothing at the limits.
SqrtNumberReturns square root of f.
TanNumberReturns the tangent of angle f in radians.
Log Base(Number, Number)NumberReturns the logarithm of a specified number in a specified base.
RoundNumber
Round To(Whole Number)Number

Random

NameTypeDescription
ValueNumberReturns a random number between 0.0 [inclusive] and 1.0 [inclusive]
Range(Number, Number)NumberReturn a random float number between min [inclusive] and max [inclusive]
On Unit SphereVector3Returns a random point on the surface of a sphere with radius 1
Inside Unit CircleVector2Returns a random point inside a circle with radius 1
Inside Unit SphereVector3Returns a random point inside a sphere with radius 1

Time

NameTypeDescription
Realtime Since StartupNumberReal time in Seconds since Modbox started
Delta TimeNumberTime in Seconds since last frame
Fixed Delta TimeNumberInterval which physics updates
World Play TimeNumberTime since play mode began in World

Text

NameTypeDescription
New LineText

Transform Part

NameTypeDescription
Can See Other Transform(Transform Part)Bool
Angle To Other Transform(Transform Part)Number

MB Type

NameTypeDescription
Get MB TypeMB Type
As Type(MB Type)Object of any TypeReturns as the given Type (if it is the type / can convert to type)
Is Type(MB Type)Bool

Vector2

NameTypeDescription
ZeroVector2
OneVector2
UpVector2
DownVector2
RightVector2
LeftVector2
Distance(Vector2)NumberReturns the distance between a and b.
Dot(Vector2)NumberDot Product of two vectors.
Lerp(Vector2, Number)Vector2Linearly interpolates between vectors a and b by t.
Move Towards(Vector2, Number)Vector2Moves a point current towards target.
Angle(Vector2)NumberReturns the unsigned angle in degrees between from and to.
Signed Angle(Vector2)NumberReturns the signed angle in degrees between from and to.
Scale(Vector2)Vector2Multiplies two vectors component-wise.
Reflect(Vector2, Vector2)Vector2Reflects a vector off the vector defined by a normal.
New(Number, Number)Vector2

Vector3

NameTypeDescription
ZeroVector3
OneVector3
UpVector3
DownVector3
RightVector3
LeftVector3
ForwardVector3
BackVector3
Distance(Vector3)NumberReturns the distance between a and b.
Dot(Vector3)NumberDot Product of two vectors.
Lerp(Vector3, Number)Vector3Linearly interpolates between vectors a and b by t.
Move Towards(Vector3, Number)Vector3Moves a point current towards target.
Angle(Vector3)NumberReturns the unsigned angle in degrees between from and to.
Signed Angle(Vector3, Vector3)NumberReturns the signed angle in degrees between from and to.
Rotate Towards(Vector3, Number, Number)Vector3Rotates a vector current towards target.
Scale(Vector3)Vector3Multiplies two vectors component-wise.
Reflect(Vector3, Vector3)Vector3Reflects a vector off the vector defined by a normal.
Project(Vector3, Vector3)Vector3Projects a vector onto another vector.
Project On Plane(Vector3, Vector3)Vector3Projects a vector onto a plane defined by a normal orthogonal to the plane.
Slerp(Vector3, Vector3, Number)Vector3Spherically interpolates between two vectors.
New(Number, Number, Number)Vector3