I need some tips

Hello!! I recently started learning lua but I’ve only been watching videos taking notes and many things, but as one of my teachers says, “the best way to learn programming is by programming, it’s useless to know a lot of theory but when it comes to programming not to know what to do” that’s why I’m here, I want to do small things to increase my knowledge but I don’t know what to start with that is neither so complicated nor so easy, where do you recommend I start?

I don’t know if this can go here, if it shouldn’t go here, sorry

Thx for read!! :smile:

1 Like

Sometimes it’s good to just play around and see what you can make with your knowledge, so that you aren’t committing yourself into projects that may be too big for you.

If you do hit the stage where you want to start on projects and you feel ready, start on a project that is within your range of knowledge, but don’t overshoot.

Make simple things, like a find the button game or an obby or something.

When you are ready, then you could commit yourself to bigger projects.

3 Likes

I started out making an obby, as you can imagine I needed a kill brick. Through this very kill brick I was introduced to the .Touched event aswell as changing properties such as Humanoid.Health. Learning the .Touched led to continue use (over-use for that matter, not included in this story) I started making a disappearing part with that same event and it led to learning loops, specifically the for-loop first. Next we went to a skip stage button where we learned how to detect button clicks and deal with MarketPlaceServices. Anyways there’s a lot more I learned from making something simple as an obby and just trying to make all the simple stuff yourself can start building you skills.

3 Likes

Here are some basics you should learn.

  1. When to use a LocalScript, Script, or a ModuleScript
    A local script activates only on the client and only replicates things on the client’s perspective.
    A server script activates on the server and can be used for things for all players.
    A module script returns a value which can be required by either a LocalScript or a Script. Or you can make a ModuleScript that requires another ModuleScript.
  2. game:GetService("Players") - the player service helps you get players. So if you wanted to check when each player joins you can do this:
game:GetService("Players").PlayerAdded:Connect(function(plr)
    -- do something with the player
end)
  1. part.Touched - when something is touching this part, the code should activate. You can also check if its a player.
part.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        -- what you want to with the player
    end
end)
  1. Get the player from a LocalScript.
    This is easily done with this:
local player = game.Players.LocalPlayer
  1. Get the character in Script
game.Players.PlayerAdded:Connect(function(plr)
    local character = plr.Character
end)
  1. Get the character in LocalScript
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- Wait() just simply waits the event for the character to be added to the player
  1. Learn loops.
-- loop while condition is true
while condition do
    print(condition)
end
-- Loop a specific amount of times
for i = 1, 15 do
    print(i)
end
-- Loop through an array with v as value
for _,v in ipairs({"a", "b", "c"}) do
    print(v) -- this would print A first, then B, then C
end
-- Loop throguh a dictionary with i as index and v as value
for i,v in ipairs({apple = "a", banana = "b"})
    print(i,v) -- prints "apple a" then "banana b"
end

Remember, this only scratches the surface on what you can do with lua.

4 Likes