Skip to content

Rail Segment

Creates a BasePart that is positioned and sized parallel to the Track. Similar to Rails in NewSmooth plugins

RailSegment

Extends Segment

RailSegment : Segment {
    BasePart : BasePart,

    Offset : Vector3,
    Size : Vector3,
    Rotation : Vector3,
    Horizontal : boolean

    MeshData : MeshData,
}

Properties

BasePart

The part used to make the rails. This will be cloned each time a new segment is created.

Offset

The offset from the CFrame

Size

Z is ignored

Rotation

Rotation

Horizontal

If this is horizontal. Used by CylinderMesh rails

MeshData

Data for a mesh that will be added to the rail on segment creation.

See MeshData

Constructors

fromData

RailSegment.fromData(data: table) -> RailSegment
data
{
    Name : string,

    BasePart : BasePart,

    Offset : Vector3,
    Size : Vector3,
    Rotation : Vector3,
    Horizontal : boolean

    MeshData : ?MeshData,
}

fromInstance

RailSegment.fromInstance(instance: Instance) -> RailSegment
instance Children
{
    BasePart : BasePart,

    Offset : ?Vector3OffsetInstance,    // see Vector3OffsetInstance
    Size : ?Vector3Value,
    Rotation : ?Vector3Value,
    Horizontal : ?BoolValue,

    MeshData : ?Instance,               // see MeshData.fromInstance
}

RailSegmentBuilder

Constructors

new

RailSegmentBuilder.new() -> RailSegmentBuilder

Methods

WithBasePart

RailSegmentBuilder:WithBasePart(basePart : BasePart) -> self

WithOffset

RailSegmentBuilder:WithOffset(offset : Vector3) -> self

WithSize

RailSegmentBuilder:WithSize(size : Vector3) -> self

WithHorizontal

RailSegmentBuilder:WithHorizontal(horizontal : boolean) -> self

WithMeshData

RailSegmentBuilder:WithMeshData(meshData : MeshData) -> self