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

SpecialMesh

Deprecated

SpecialMesh

Deprecated

The SpecialMesh is an object that allows developers to provide a standard template or user uploaded mesh to a BasePart.

What does a SpecialMesh do?

The SpecialMesh object applies a mesh to a BasePart depending on the the SpecialMesh/MeshType property. A number of options are available.

  • Brick - A block shape, equivalent to a BlockMesh
  • Cylinder - A cylinder, identical to a Part with a Part/Shape of ‘Cylinder’
  • FileMesh - A user uploaded Mesh, equivalent to FileMesh that a texture can be applied to using the FileMesh/TextureId property
  • Head - A character head shape
  • Sphere - A sphere shape, similar to a Part with a Part/Shape of ‘Ball’ but can be freely resized on all axis
  • Wedge - A wedge shape, identical to a WedgePart
  • Torso - A block with sloped sides, due to be deprecated

Note, each SpecialMesh/MeshType will scale differently when using DataModelMesh/Scale, for more information on this please see the page on DataModelMesh/Scale. The SpecialMesh object also exposes the DataModelMesh/Offset property.

It is important to remember that when using a SpecialMesh, only the appearance of a part changes. The collision model of the part remains the same. For example, a character will not be able to walk correctly over a mesh as the mesh geometry is not taken into account.

SpecialMesh or MeshPart?

There are currently two ways of using a developer created mesh. They are using a SpecialMesh with the SpecialMesh/FileType set to ‘FileMesh’, or by using a MeshPart. Although, on the whole, the MeshPart object has superseded the SpecialMesh there are some differences developers should be aware of.

  • BasePart/Material displays correctly on the mesh when using a MeshPart and not when using a SpecialMesh
  • MeshParts include the MeshPart/CollisionFidelity property, meaning the collision model of a MeshPart can be set to resemble the geometry of the mesh. The SpecialMesh object by contrast, uses the parent BaseParts collision model
  • The mesh of a MeshPart scales on all axis depending on the BasePart/Size|Size property of the MeshPart, the mesh of a SpecialMesh does not
  • The SpecialMesh object includes the DataModelMesh/Offset|Offset and DataModelMesh/Scale|Scale properties whereas MeshParts do not
  • The FileMesh/MeshId|MeshId property of a SpecialMesh can be changed by a Script or LocalScript during runtime. The MeshPart/MeshId|MeshId property of a MeshPart can not.

In most, but not all cases, using a MeshPart is more suitable. As MeshParts are a relatively new feature however, developers should expect some of the above behaviour to change.

Uploading a custom mesh

Although a developer uploaded mesh can be used on a SpecialMesh, meshes can currently only be be uploaded using MeshParts or the game explorer. For more information on how to do this please see Articles/Mesh Parts|this tutorial.

Properties

MeshType

MeshType

Determines the type of mesh that will be applied to the BasePart the SpecialMesh is parented to.

Inherited from FileMesh: Show Hide

Content

MeshId

The MeshId is the content ID of the mesh that is to be displayed.
Content

TextureId

The TextureId is the content ID of the texture that is to be applied to the mesh.

Inherited from DataModelMesh: Show Hide

Vector3

VertexColor

Changes the hue of the mesh's texture. Only functional when used with the `SpecialMesh` object as it includes the `SpecialMesh/TextureId` property.
Vector3

Scale

The Scale of a mesh determines the size of the mesh relative to its original dimensions.
Vector3

Offset

The Offset of a mesh determines the relative position from the `BasePart/Position` of a `BasePart` that the mesh will be displayed at.

Inherited from Instance: Show Hide

int

DataCost

[ReadOnly] [NotReplicated]
The cost of saving the instance using data persistence.
Instance

Parent

Determines the hierarchical parent of the `Instance`.
bool

RobloxLocked

If true, the `Instance` and its descendants cannot be indexed or edited by a `Script` or `LocalScript` and will throw an error if it is attempted.
string

ClassName

[ReadOnly] [NotReplicated]
A read-only string representing the class this `Instance` belongs to.
string

Name

A non-unique identifier of the `Instance`.
bool

Archivable

Determines if an `Instance` can be cloned using `/Instance/Clone` or saved to file.

Functions

Inherited from Instance: Show Hide

Array

GetDescendants ( )

[CustomLuaState]
Returns an array containing all of the `Instance`'s descendants.
bool

IsAncestorOf ( Instance descendant )

Returns true if an `Instance` is an ancestor of the given descendant.
bool

IsDescendantOf ( Instance ancestor )

Returns true if an `Instance` is a descendant of the given ancestor.
Instance

FindFirstChildWhichIsA ( string className , bool recursive )

Returns the first child of the `Instance` for whom `Instance/IsA` returns true for the given className.
Instance

FindFirstChildOfClass ( string className )

Returns the first child of the `Instance` whose `Instance/ClassName|ClassName` is equal to the given className.
Instance

FindFirstChild ( string name , bool recursive )

Returns the first child of the `Instance` found with the given name.
Instance

FindFirstAncestorWhichIsA ( string className )

Returns the first ancestor of the `Instance` for whom `Instance/IsA` returns true for the given className.
Instance

FindFirstAncestorOfClass ( string className )

Returns the first ancestor of the `Instance` whose `Instance/ClassName` is equal to the given className.
Instance

FindFirstAncestor ( string name )

Returns the first ancestor of the `Instance` whose `Instance/Name` is equal to the given name.
bool

IsA ( string className )

Returns true if an `Instance`'s class matches or inherits from a given class
Instance

WaitForChild ( string childName , double timeOut )

[CustomLuaState] [CanYield]
Returns the child of the `Instance` with the given name. If the child does not exist, it will yield the current thread until it does.
RBXScriptSignal

GetPropertyChangedSignal ( string property )

Get an event that fires when a given property of an object changes.
string

GetFullName ( )

Returns a string showing the `Instance`'s ancestry.
string

GetDebugId ( int scopeLength )

[NotBrowsable]
Returns a coded string of the `Instance`s DebugId used internally by Roblox.
Objects

GetChildren ( )

Returns an array containing all of the `Instance`'s children.
void

Destroy ( )

Sets the `Instance/Parent` property to nil, locks the `Instance/Parent` property, disconnects all connections and calls Destroy on all children.
Instance

Clone ( )

Create a deep copy of a Roblox instance and descendants where `Archivable = true`.
void

ClearAllChildren ( )

This function destroys all of an `Instance`'s children.

Events

Inherited from Instance: Show Hide

RBXScriptSignal

AncestryChanged ( Instance child , Instance parent )

Fires when the `Instance/Parent` property of the object or one of its ancestors is changed.
RBXScriptSignal

ChildAdded ( Instance child )

Fires when an object is parented to this `Instance`.
RBXScriptSignal

ChildRemoved ( Instance child )

Fires when a child is removed from this `Instance`.
RBXScriptSignal

DescendantAdded ( Instance descendant )

Fires when a descendant is added to the `Instance`.
RBXScriptSignal

DescendantRemoving ( Instance descendant )

Fires immediately before a descendant of the `Instance` is removed.
RBXScriptSignal

Changed ( string property )

Fired immediately after a property of an object changes.