User:Legend26/Test
From Legacy Roblox Wiki
Jump to navigationJump to search
< Scripting | Data Types
An Enumeration, or Enum, is a type of data that represents a selection. For example, the SurfaceType Enum has different options for selecting what type of surface a brick has. Some of which are "Glue", "Hinge", and "Inlet". These are names on selection types. Here is a table of all the text values.
Methods
Enums also have a single method:
GetEnumItems( ) | |
Returns | Table enumItems |
Description: | Returns all the EnumItems in the Enum. |
Member of: | Enum |
Usage
You can set an Enumerated property through Lua in the following three ways:
Example
To set the SurfaceType enum for RightSurface to Weld:
game.Workspace.Part.RightSurface = Enum.RightSurface.Weld
-- or
game.Workspace.Part.RightSurface = 2 -- setting it with the id of the enum value
-- or
game.Workspace.Part.RightSurface = "Weld" --Setting it with the name of the enum value