youbigown
(youbigown)
December 5, 2023, 11:16pm
1
I have a variable “latestCamMode” that is set to a string value equal to the name of cameramodes.
So to save a bunch of if/else statements - is it possible to do what is theorized below? At the moment it is doing an error if written like this of course.
plr.CameraMode = Enum.CameraMode.latestCamMode
NyrionDev
(Nyrion)
December 5, 2023, 11:21pm
2
local val = "latestCamMode"
plr.CameraMode = Enum.CameraMode[val]
1 Like
alexb_83
(alex)
December 5, 2023, 11:21pm
3
plr.CameraMode = Enum.CameraMode[latestCamMode]
youbigown
(youbigown)
December 5, 2023, 11:23pm
4
thanks. I know this question has prob been asked a lot, but it’s a difficut question to search up due to its many ways of phrasing.
NyrionDev
(Nyrion)
December 5, 2023, 11:25pm
5
For future questions you can try removing information, for example, this can be converted to “How can I convert a string to an enum”.
1 Like
system
(system)
Closed
December 19, 2023, 11:25pm
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.