Need Lua tutorials

Hi,
I was looking for some very advanced programming tutorials in Lua but found nothing. I don’t just mean youtube tutorials, I read a lot on Developer Hub, but it is briefly translated there, for example I don’t understand what .Unit is doing, because it was too complicated.

Please help. :pray:

1 Like

There isn’t really any one great place to find tutorials, you’ll have to do what you’ve been doing already and search around on the internet. Roblox is still a bit niche when it comes to games programming, so sometimes you have to look to other languages or game engines to find what you need. Otherwise, just search here on the devforums when you have a specific question and make a post if you don’t find a good answer.

As for .Unit, you can read about it here: Vector3 | Roblox Creator Documentation (wiki.roblox.com)

If you don’t understand what any of that means, you might want to learn the basics of vector math. Here’s a good video on unit vector specifically: https://www.khanacademy.org/math/precalculus/x9e81a4f98389efdf:vectors/x9e81a4f98389efdf:unit-vec/v/intro-unit-vector-notation and here’s an entire introductory course on vectors in general: Vectors | Precalculus | Math | Khan Academy

2 Likes

I think if you dont understand it then you arent ready for it yet, start from the basics and use the APIs and you will begin to understand more of the advanced stuff.

Id say pick a few things that are going to be useful in the future and work at making a simple versions and then making them easier to use and more effiecient

1 Like

I don’t know what’s .Unit because nowhere is it clearly explained, but I know, for example, what is .Magnitude and what it does.

1 Like

Vector2/Vector3.Unit returns a vector with the same direction but with the length of 1 [stud].

1 Like

I don’t even know what .Unit does, it took me a 2 sec google to have all the answers to use it in a script.

I prefer doing things in a less complicated way as it will do exactly the same thing. For example rather than using .Unit I would just make a CFrame ratio to get the direction which gives the same result just in a different way that I can understand and also allows me to better fine tune my scripts.

There are always multiple ways of accomplishing the same kind of end result, its just finding the right way for you to progress from. Even if you don’t have all the knowledge of .Unit and other things there are still ways of doing the same thing that can actually prove to be more useful as you can understand every step of your script. There are many who try to maximise efficiency with their scripts but .Unit simply takes the vector and sets it to one, there is still script usage behind .Unit even if it seems shorter. This is why it really doesn’t matter too much how you go about it as you can always optimise a script you actually understand.

1 Like