How to create enums

Sorry this post was rushed–

how do I create my own enum? Is it like in python??

2 Likes

Enum is a sort of dictionary which stores core Roblox values to be used in every script (which is how I define it)
It’s because of this that you can’t really add or remove anything to it, but what you can do is use a ModuleScript as a “fake enum” (or a dictionary).

For example, your ModuleScript could look something like this:

local fakeEnum = {
   ["ValueName"] = "Value",
   ["ValueName2"] = {
      1,
      2,
      3,
   },
}

return fakeEnum

and then just retrieve that data with:
local fakeEnum = require({filepath})
(obviously, replace {filepath} with the location of your module script)

Hope this helps!

Edit: changed some wording around

3 Likes

would you mind helping me with this aswell? Nobody has answered it yet

Sure! Sorry I didn’t see this earlier, I was kinda busy.

Never mind, just saw it was already solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.