Ive always been confused about what an enum is. Ive used them before with UserInputService but I never knew what the enum does or what it means. Can someone explain, thankss.
✓ ANSWER ACCEPTED
Im confused about what an "enum" is, can someone explain?
2 answers
✓ Accepted answer
Enum is short for enumeration. Basically if you're trying to change say the material of a part which has a selection of mats for you to choose from (brick, neon, smooth plastic, etc), you use enum.
Part.Material = Enum.Material.SmoothPlastic
UserInputService is another thing you can use enums for. Say you're trying to detect when a player presses E. There's a selection of keys that you can choose from (W, Space, LeftAlt, RightShift, etc).
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
--blah blah blah
end
end)
If you want to learn more about Enum, click here.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I googled and got this An enumeration — sometimes shortened to “enum” — is a special data type that can take one of a set of values. For example, the Material enum represents the material type for a part. See the Enum Index for a full list of enum types in Roblox. In a script, enums are accessed through a global object called Enum .link:https://developer.roblox.com/en-us/articles/Enumeration#:~:te