Welcome To Robloxia - Learn To Code

PLEASE KEEP IN MIND THAT DEVELOPING GAMES AND LEARNING TO CODE WILL TAKE TIME AND EFFORT

Hello new or returning developers, I hope you are having an amazing day, in this tutorial you will learn the basics and advanced mechanics of LuaU(Roblox Lua), I am AllabyAiiaby and I will be your guide, so shall we begin?


Setup, Variables & Print()

SETUP

To begin click this link to download Roblox Studio, then run the downloaded file and open roblox studio.

Now click on the new tab (opened by default) on the left hand sidebar and click on Baseplate or Old Baseplate.

Once you have opened up Baseplate and it has loaded on the top of your screen click on the words ‘View’ and then make sure you select all these options below:

  • Properties
  • Explorer
  • Output

and then put your mouse to the sides of these boxes and drag them to be as small as possible to not obstruct your view as much, well done!

We now have a brand new project ready to configure, lets move on!


VARIABLES AND PRINTING

Now in our explorer (most likely on the right of your screen) look for the text ‘ServerScriptService’ hover over it and then click the + icon and search ‘Script’ add a new Script, make sure not to add a local or module script!

First to begin with understanding the studio let’s talk about services:

  • Workspace
    The workspace is everything that the player can view (without exploiting) and is where most of your builds and non-scripting related objects will be!

  • Players
    This will (when you start your game) be where your player’s information and object will be, this is where you can edit anything about the player.

  • Lighting
    We will not be mentioning this in this tutorial!

  • Replicated First
    We will not be mentioning this in this tutorial!

  • Replicated Storage
    Replicated Storage is one of the only services that allows both the client (player) and server (game) to communicate between each other, this is where most of your communication with the client will take place using events.

  • ServerScriptService
    This is where most if not all of your server scripts will be located, the client will not be able to access any scripts located here meaning that hackers cannot edit scripts here, which is essential to your games protections.

  • ServerStorage
    This service cannot be accessed by the client so keep all your important items that you will introduce into the game later in here, such as a overhead UI (User Interface)

  • StarterGui
    This is where all your pre-game GUI will be managed and configured, on game start this will replicated into PlayerGui (We will talk about this in more detail later).

  • StarterPack
    Any items/tools put in here will be put in the players toolbar/hotbar on game start.

  • Teams
    Teams is where all your teams will be managed.

  • StarterPlayer
    This is where all you character and GUI scripts are recommended to be located in.

  • Other Services that will not be mentioned in this tutorial

Right, so now we know the services of Roblox, now double click your script in roblox and you should be granted by this:

print("Hello World!")

Now if you go to your ‘Home’ tab and press the arrow below play/run and click on play, and in your output (most likely located on the bottom of your screen) you should see:

Hello world!  -  Server - Script:1

then click stop to return to your editing.

Now we know the basics of scripts and services lets look at variables and print().

A variable or var is a type of storage method that can be chaned and used later on, let’s say sahara has 5 cups and 2 juice bottles, we need to create a var to hold these values, to create a var type local var_name = var_value in our case we need to create 2 variables with 2 different values so lets do that like this:

local cups = 5
local bottles = 2

(Keep in mind you can not create a variable name with spaces either use camelCase or underScores_)
We use local to define that this variable is only going to be used inside this script (We will talk about global variables later) and then insert our variable name we use = to then assign a value and then type our value, if you want to know more about operators(±=) then go to this page, now we want to tell our guests how much we have so we use this code:

print('We have '.. cups ..' cups and '.. bottles ..' bottles')

Running the game will give you:
We have 5 cups and 2 bottles - Server
Notice how we use two periods(.) this conjoins values, and why didn’t we put our var’s in ‘’ or “”, well because if we use “” or ‘’ we are telling the program that we are printing or defining a string, and a variable should never be printed or used in anything other than defining it using ‘’ or “” else our output would have been We have cups cups and bottles bottles

Here are the variable types:

  • String
    A string is text and defined in-between ‘’ or “” and is defined as such
    local variable = ‘Hello World!’

  • Interger
    This is a number value and is defined as such:
    local variable = 0

  • Boolean
    A true of false value, defined as such:
    local variable = true (or) local variable = false

Well done you have completed section one!


The seconds part of this tutorial will be released later on today, make sure to keep updated on new updates within this tutorial!


NEW UPDATE : BST 22/05/2022 15:10


Hey, check out the complete revamp of this tutorial, I really hope all begineer and returner developers enjoy this public resource and any community feedback will be considered and added, thank you Robloxia for your great help to my journey, now it’s my turn to give back to you.


UPDATE : 10:50 24/05/2022 BST


This project will not be updated until I have completed my current work which will be released soon as of this announcement!

28 Likes

Any feedback on how to improve this tutorial is very much appreciated, thank your for visiting :smile:

3 Likes

Good job man,

I’d suggest you to add more examples, so beginners would find this tutorial - unique and helpful even more!

2 Likes

I plan to add that tomorrow as well as adding more sections as mentioned in the end

That is it for now however, be sure to stay alert for new updates, as I will be adding towards this project for days to come, I am only not completing it now due to the time in my area (weirdly I have other things to do as I am alive) as such make sure to keep your eyes on this project for update tommorow, good
bye and have a happy day!

3 Likes

A new sections has been released, make sure to read it
:school: :school_satchel:

1 Like

Really amazing tutorial for new coders. Would have learned how to script much faster if I had this :grinning: :smiley: :star_struck:! For the next couple tutorials do Humanoid, for loops Vector3's and while loops.

2 Likes

Thanks for the suggestion of what to add, will do so :smiley:

Released the Loops sections, thanks for the idea :slight_smile:

Format your code and use task.wait

1 Like

Thanks for the help with the improvements, I have never really used task.wait personally that is why I did not include it or think of including it!

As for formatting I do format code on my own projects however since this code is not massive I do not see the need to format the code as formatting is used to make large sections of code clearer, however the code in this tutorial are snippets as such I have not formatted it! Thanks anyway :smile:

Still do, makes it harder to read. You should be making ur code cleaner as you’re showing it to beginners so it should be clean

Will do!

POSTLIMITPOSTLIMITPOSTLIMIT

Don’t forget to mention Roblox allows 200 locals per script its a fact not-known by many programmers

just in case you exceed the limit by not using modules or tables …etc

2 Likes

I will add that now, thanks for reminding me!

An easy workaround is tables.

local variabletable = {
Apple = true,
coolModule = require(urmodule)
}

print(variabletable.Apple)
variabletable.coolModule.dosomething()
2 Likes

I will be including tables later on in the tutorial, that is why I only mentioned modules in how to bypass, and yes tables are an easy workarround, also keep in mind I will be mentioning with the ModuleScripts that _G is bad practise once your understand module scripts

2 Likes

There are much better resources Hour 11. Lua Overview - Roblox Game Development in 24 Hours: The Official Roblox Guide [Book]

I know, I thought might aswell make a tutorial just in case, like me, they made no sense except the only thing they taught me is how to type hello world claps

They think that to make a game like adopt me you just have to type this

while true do
print('Hello World!')
end

And so I created a tutorial for the basic luau!

Nice job with the loops and ifs elseifs.

1 Like

Thank you so much, I will be adding more soon :slight_smile:

1 Like