Easier Ways to Learn Lua

Is there an article or a tutorial site that would help me understand Roblox Luau better?

To be honest, I want to learn Luau in a simpler way. I’ve read plenty of articles and done a lot of research, but it hasn’t really helped. I’ve watched tutorial videos, but since my English is only at an intermediate level, there are very few Luau tutorials available in my own language.

3 Likes

Maybe the Roblox documentation combined with tutorials in your preferred language. The documentation helps with things you don’t know how to use or are struggling to understand

4 Likes

for me personally, the best way to learn something is to just create right away with no experience, start by trying to replicate something simple and while you’re doing so search “how to do this” “how to do that”, and check the docs too, as for the language lua i did the same thing but it wasn’t for roblox it was for an entirely different game so you might want to stick to the tutorials or learn basic lua at Lua: reference manuals

2 Likes

Most of my experience comes from making stuff I think would be cool and looking at open-source projects

AI is really good at explaining things in detail without getting annoyed like a human if you don’t understand; plus, it supports all languages, so I strongly recommend using that to your advantage. It helped me a lot in learning advanced stuff like buffers and other complex systems

Most of your answers for your questions will be answered using AIs

There isn’t a magic trick to be good at it, it’s all about time and experience

2 Likes

tutorials and documentations are good but they will not get you far without practice and application. if you want to learn luau fast, you should make literally anything in studio

1 Like

Read official documentation?
https://luau.org/getting-started/

4 Likes

Leer la documentación de Roblox o la de Luau, como dice @af_2048, está bien y yo también lo hice, pero te recomiendo ver a @BrawlDev en YouTube (no la cuenta)

on this note use the wiki with ai, so if you dont know something you read the wiki, then ask the ai about specific things, ai as a whole isnt very good for coding but it is good when it comes to asking specific questions for example ‘Whats the difference between a remote event and a bindable event’ itl be able to tell you that kind of thing.

I highly reccomend making small sections of code relating to specific topics then building on that as you go along, itl go something like this:

variables + accessing parts via game.Workspace.Part
in built functions - take ^ and use :FindFirstChild(“Part”) and try it with different names parts and printing
basic if statements - if Part then do x, pretty standard code
basic functions - When function called find the part
basic event - find a part, when the part is touched run x code
parenting - how about finding the player from the part thats returned from the touched event
basic tables - now lets make a folder containing a whole load of parts, once the part is touched use a for loop to change all of the parts colours
combining loops and basic events - now lets say we want each part to change when only itself is touched, a for loop that connects the touched event to each part

so far what this covers is more or less

local Part = game.Workspace.Part
if Part then
   Part.BrickColor = "Green"
end

--Upgrade
local Part = game.workspace:FindFirstChild("Part")
Part.Touched:Connect(function(TouchedPart)
   Part.BrickColor = "Green"
end)

--- Upgrade
local Part = game.workspace:FindFirstChild("Part")
Part.Touched:Connect(function(TouchedPart)
   for i,v in pairs(game.workspace.PartsFolder:GetChildren() do
      v.BrickColor = "Green"
   end
end)

--- Upgrade
local Parts = game.workspace.PartsFolder:GetChildren() -- Gets the list of parts
for i,,v in pairs(Parts) do --I being the index, eg 1,2,3 and v being the value, eg part
   v.Touched:Connect(function(Part) --This is how we define a function and connect it 
      v.BrickColor= "Green" --Just a example color
   end) -- This is the end of :Connect
end

then thatd be the basics of like parts etc until later on when you have a more specific use case.
then we would move to say data store which learning those kind of goes like:

Getting the service - Common and rather easy its a inbuilt function which we touched on before
Getting the store - the name of the store you want to access
Saving, loading and updating the store using a player id - Ayncs
next up we have error handling, as datastores can fail and if you dont catch errors thats bad news
so that will use pcall, maybe include a loop that breaks when it succeeds at saving/loading

-- Very bare bones basics
local DSS = game:GetService("DataStoreService") -- Short For DataStoreService
local Store = DSS:GetDataStore("NameOfTheStore") -- Get The Name of the store
local Data = Store:GetAsync(UserID) or 0 --Or can be used, so if theres no data its 0

-- improving this
local function SetData(Store,Key)
   local Store = DSS:GetDataStore("NameOfTheStore") -- Get The Name of the store
   Store:SetAsync(UserID)
end

-- Upgrading again
local function SetData(Store,Key)
   local Store = DSS:GetDataStore("NameOfTheStore") -- Get The Name of the store
      local S,E = pcall(function() -- Catches error, S for success, E for error
          Store:SetAsync(UserID) -- Code we want to catch errors for
      end)
      if S then --It saved
        return --Could also use break, but return exits out of the function as well
        -- We want to do this otherwise our code will run multiple times
        -- Keeps code running faster, as well as datastores having limits
        -- This is pretty standard procedure with datastores
      end
end


-- Upgrading again
local function SetData(Store,Key)
   local Store = DSS:GetDataStore("NameOfTheStore") -- Get The Name of the store
   for i=1,5 do -- Runs this code 5 times (Unless break or return is used)
      local S,E = pcall(function() -- Catches error, S for success, E for error
          Store:SetAsync(UserID) -- Code we want to catch errors for
      end)
      if S then --It saved
        return --Could also use break, but return exits out of the function as well
        -- We want to do this otherwise our code will run multiple times
        -- Keeps code running faster, as well as datastores having limits
        -- This is pretty standard procedure with datastores
      end
   end
end

-- Using this function (Assume we made these for loading etc too
local PlayerData = {} -- Lets make a dictionary to store the player data (Table of sorts)
game.Players.PlayerAdded:Connect(function(Player) -- Someone joined lets get data
   -- so PlayerData["PLAYER1"] will hold this players data
   -- Note on this next line i use to string, this is beacause datastores use string
   PlayerData[Player.Name] = LoadData("Inventory",tostring(Player.UserID)) or {}
   -- so this here will either load their inventory, or create a new table
end)

--now lets say they buy or pick up a item, lets add that
table.insert(PlayerData["Player1"],"Grapple Hook")
--then we save it when they leave
game.Players.PlayerRemoving:Connect(function(Player) -- Event And Connected function
   SaveData("Inventory",tostring(Player.UserID)) -- Our function to save
end)

This is by no means a perfect example but its a good example of how things quickly layer up with each set of improvements, for every what if you have, like what if this was easier to use, theres a soloution, This code here could still be improved by miles but this is kind of the proccess most of us actually go through when learning to do real code.

Youtube tutorials will hold you back from this self review/improvement method that actually gets you to learn things and come up with methods that work with your own scripting style

Main thing to learn early doors is the general layout of code, eg function contains this, if we use :Connect(Fuc) we can create the function within :Connect(), using for i,v in pairs, the difference between findfirstchild and waitforchild and when to use them.

What id do is give this a crack, so follow along what ive said with each itteration of improvements, see what changed and why, what benifits is there to doing that method vs what we had before even though both work

Your learn pretty early on that its worthwhile having functions as you can essentially copy and paste to do what you want, What id advise is follow along with this and then look at small scale coding exersizes, like from what we made above thats literally only a couple of steps away from being able to function as a game where you run around picking up items

Some things to read up on/ask your ai:
Dictionarys + tables whats the difference
What can I put into said tables + dictionarys (DataTypes)
common roblox events eg PlayerAdded/Removed and why its good to use events instead of loops
Client vs Server scripts, what can server do that client cannot, and vise versa
Client vs Server replication, as in what happens on the client only happens for 1 player, server is all
What is a module script and when might you use one
How does this effect the code you write, eg a handler for something, or just a means to functions
Whats the difference if both a server and client use the same module script
can you detect if its the server or client thats calling on the modules functions

theres more advanced topics that lead on from this but this is the baseline of more or less what you need for entry level coding and this is arguably the most important bits to learn, the context you learn at the start now will effect how you learn everything that follows so if you get real familiar with the basics your have a easier time later on

1 Like

It takes about five years to really get a good feel of what a language can do. Even if you know others.
There is no need to rush it, truth is the learning never ends. It is part of the craft. Becoming good at research to find your answers is more the key to learning them all.

2 Likes

I will proceed based on this article. Thank you for your interest and assistance

1 Like

Nailed it. I hate to say I have been developing on Roblox for almost 10 years, but despite that I still am actively learning new things. On top of this, Luau changes as developers continue to learn.

2 Likes

Well, it’s not only scripting… it’s that and using that to work with the many modules, libs, tools, concepts… on and on it goes. A game creator is a unique programmer, more of a jack of all trades.

2 Likes

Hey @HelluvaBoos3! How are you doing?

The question that you shared here is the “one million dollar question” that people have been asking over the years and I loved how everyone helped by providing different opinions. So, with that being said, I would like to also provide my own vision:

When it comes to learning programming, not matter what the language you chose, such as Python, JavaScript, C++, and what it’s your main goal with it, whether for web application, data systems, you’ll find plenty of resources online, such as bootcamps, articles and tutorials from social media platforms (as you said here). It’s important to know that, despite having some obstacles mentioned, it’s not impossible to learn.

It’s understandable that when you come from another culture, you tend to do a local research. This happens a lot when we want to learn things as we’re comfortable listening and communicating in our own cultural language. However, I would recommend you learning through English for being the most common language spoken globally. It opens thousands of doors where you can explore and try out new information that you have never seen before while climbing your way to learn Luau. Also, you don’t have to worry about the proficiency levels of English (A1, A2, B1, B2, C1, C2) because they don’t heavily affect when you’re getting your hands into coding. The programming languages that I brought in the previous paragraph are considered as “high-level languages”, meaning that they’re the closest for a human to understand, and so Luau. As long as you’re able to remember the names of reserved keywords like local, function, you’ll realize that it isn’t a real biggie.

Another thing to take into consideration is that, while learning programming and having plenty of resources on the internet on the palm of your hand, you’ll initially feel confused on where to start. Considering that it’s a lot of information for someone to stand on, you’ll likely go and hunt for the easiest ways on how to go from novice to a legend. Some people would recommend watching X, Y, and Z tutorials, others using an artificial intelligence, the official documentation from Luau and/or Creator Documentation. Still, even if you have a bunch of recommendations and advice, it’s important to remember there’s no perfect formula for learning this any faster. Consuming these types of contents by listening and visualizing will make you happy at first, the determination of actually learning. You’ll find the theory easy, but on paper, you might find some struggles at the end. What matters mostly isn’t consuming, but actually practicing. Practicing is fundamentally the only way on how you can evolve your knowledge from things you want to learn. This isn’t exclusively for programming, but also in other areas that you have a huge curiosity for. Practice what you’ve learned by understanding the basic principles and apply them in Roblox Studio. You can start with simple changes, like changing the color of a primitive shape (Part, Cylinder, Sphere, or Wedge). Once you feel comfortable, you can also try a method called “reverse-engineering”, grabbing models from the Toolbox and break down their complex scripts piece by piece. Keep in mind that even the most complex code is just a combination of simple functions, which are easy to deconstruct when you understand the overall goal.

In a nutshell, don’t get caught in the trap of endlessly consuming tutorials and tips, instead practice consistently. As said before, there’s a lot of information given in your hand, but what truly matters is putting it into action. As one person told me, “Programming isn’t easy, but it’s far from difficult.” The gap between these two truths is bridged by doing, not by watching. Take your time to do this at your pace.

Hopefully, this advice can help you out. You can do it!

1 Like