I need to use complex numbers for a script but I can't find anything on how to use them in Roblox.
Can you use imaginary and complex numbers in Roblox Studio?
2 answers
Roblox does not have native support for complex numbers as far as I know. There's most likely some other person on roblox who has already made a module that does allow you to use complex numbers, but if you can't find anybody who has done that, I recommend making a module for complex numbers yourself. It should be as easy as having the first key be the real part, and having the second key be the imaginary part. Then add a metatable to deal with addition, subtraction, and all that stuff, and you should be good to go.
I don't exactly know what you mean by complex numbers but I assume otherwise. If so, I suggest you use a function called math
Math can be used for angles/irrational numbers, other calculations etc.
i.e This script finds the square root of 64
local number = 64
local calculation = math.sqrt(number) -- 8
print(calculation) -- Prints 8
Likewise, there are many subsidaries to math including math.pi and math.atan
There is more tutorials to math here
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Unfortunately, ROBLOX does not have a native subclass that can manage Complex datatypes. You'd have to design your own via OOP that yield "real" & "imaginary" containers; remember to follow the general rule of i2 = -1