Beginner Roblox And Lua: Start making Games with Roblox Studio | Kaupenjoe (Nico) | Skillshare
Search

Velocidade de reprodução


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Roblox e Lua para iniciantes: comece a criar jogos com o Roblox Studio

teacher avatar Kaupenjoe (Nico), CS Student, Nerd and Educator

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introdução ao meu curso Roblox

      0:45

    • 2.

      Visão geral do curso

      1:12

    • 3.

      (Lua) Instalando o Roblox Studio

      3:10

    • 4.

      (Lua) Tipos variáveis em Lua

      6:31

    • 5.

      (Lua) Saída e comentários

      7:37

    • 6.

      (Lua) Operações de matemática

      10:54

    • 7.

      (Lua) Operações relacionais e lógicas

      11:15

    • 8.

      (Lua) Se e outras declarações

      9:50

    • 9.

      (Lua) Variáveis locais

      4:07

    • 10.

      (Lua) Operações de corda

      7:47

    • 11.

      (Lua) Loops em Lua

      8:46

    • 12.

      (Lua) Funções em Lua

      4:50

    • 13.

      (Lua) Mesas em Lua

      10:50

    • 14.

      (Lua) A Biblioteca de matemática em Lua

      8:11

    • 15.

      (Roblox) Roblox Studio explicado

      6:42

    • 16.

      (Roblox) Referência a uma parte

      7:00

    • 17.

      (Roblox) Tipos de scripts

      7:25

    • 18.

      Visão geral de propriedades

      9:15

    • 19.

      (Roblox) Vector3 e posição

      7:31

    • 20.

      (Roblox) A função de espera

      2:54

    • 21.

      Movimento de parte básica

      3:18

    • 22.

      (Roblox) o evento tocado

      7:43

    • 23.

      (Roblox) Criando instâncias a partir de scripts

      6:29

    • 24.

      (Roblox) Clique no detector

      6:22

    • 25.

      (Roblox) aplicando forças

      9:08

    • 26.

      Restrições (Roblox)

      8:14

    • 27.

      Pontos de geração (Roblox)

      3:36

    • 28.

      Jogador (Roblox) vs personagem

      3:12

    • 29.

      (Roblox) poupando variáveis no jogador

      5:21

    • 30.

      Quadro de liderança com Leaderstats

      10:01

    • 31.

      (Roblox) peças colecionáveis

      15:27

    • 32.

      (Roblox) Adicionando trilhas para o jogador

      7:47

    • 33.

      (Roblox) três tipos de GUIs

      10:38

    • 34.

      Referências de API (Roblox)

      3:13

    • 35.

      (Roblox) Introdução e como esta seção é construída

      1:04

    • 36.

      (Roblox) Modelagem no Obby

      27:42

    • 37.

      (Roblox) Adicionando pontos de verificação no Obby

      5:47

    • 38.

      (Roblox) Adicionando um quadro de liderança com Leaderstats

      9:34

    • 39.

      (Roblox) Adicionando escadas desaparecidas no Obby

      11:33

    • 40.

      (Roblox) Adicionando peças móveis para o Obby

      11:41

    • 41.

      (Roblox) ideias adicionais para o Obby

      2:31

    • 42.

      (Roblox) Publicando seu jogo

      6:45

    • 43.

      (Roblox) Adicione fotos para sua GUI

      4:46

    • 44.

      (Roblox) armazenando dados de jogador com DataStoreService

      22:40

    • 45.

      (Roblox) vários lugares em um único jogo

      2:38

    • 46.

      Teleporte entre diferentes lugares

      4:42

    • 47.

      (Roblox) Para onde ir daqui

      1:27

  • --
  • Nível iniciante
  • Nível intermediário
  • Nível avançado
  • Todos os níveis

Gerado pela comunidade

O nível é determinado pela opinião da maioria dos estudantes que avaliaram este curso. Mostramos a recomendação do professor até que sejam coletadas as respostas de pelo menos 5 estudantes.

2.562

Estudantes

3

Projetos

About This Class

Você sempre quis criar seus próprios jogos, mas não sabia por onde começar? Este é exatamente o curso que você precisa! Atualizado para 2023

Neste curso novato Roblox e Lua você vai aprender o básico da linguagem Lua e o desenvolvimento de jogos com o Roblox Studio. Nenhuma experiência é necessária para aprender os entraves e saídas de fazer Jogos com o Roblox Studio.

Este curso é acessível para iniciantes completos. Mesmo que você nunca tenha programado em sua vida. O conhecimento básico do Roblox seria vantajoso, mas não é necessário.

Primeiro, você aprenderá Lua, então vamos passar por conceitos básicos do Desenvolvimento de jogos Roblox e como parte do curso, você até fará seu primeiro jogo!

Todo o código fonte será disponibilizado para que você possa acompanhar tudo o que faço nas palestras.

Se você tiver alguma dúvida ou sugestão, não hesite em contactar-me aqui. Fico feliz em ajudá-lo a aprender a fazer Jogos com o Roblox.

Conheça seu professor

Teacher Profile Image

Kaupenjoe (Nico)

CS Student, Nerd and Educator

Professor

I am Nico - also known as Kaupenjoe - I have a Master's Degree in Computer Science and teach Game Development through many different classes. Mid-2020, when I became a bit disillusioned with my job, I set my sights to something different. Multiple people have previously told me I was good at teaching things.

With some of my prior YouTube Video making knowledge I was able to make my first courses. The Minecraft Courses in particular made a huge impact on students and myself and allowed me to teach full-time with courses and other supplementary methods.

I hope you will also join me and allow me to help you learn Programming, Modding or Game Development. As a hobby, side-hustle or as a promising career, it is an amazing and fulfilling field and I'm so happy to have y... Visualizar o perfil completo

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction to my Roblox Class: Hello, I'm Nico, also known as Calvin draw and welcome to my beginner class for roadblock scripting here on Skillshare. In this class, you will learn your first steps into making games with Roblox. Even complete beginners are welcome here, as there is a Lua introduction included in this class. After you've familiarized yourself with Lua, we'll look at some basic Roblox concepts such as click detectors, changing positions and the Touched event. And of course, way, way more equipped with that knowledge. You will then go on to making your project. Your first ONE game, which is going to be an RB. You can use all you learned and more, let your creativity run wild. In the end, there's even going to be some additional intermediate topics which are going to be really useful for Romanovs game making as well. So what are you waiting for enrolling in this class now and begin the first steps to creating awesome games and Roblox. I'll see you in the first lesson. 2. Overview of the Class: All right, Welcome to the beginner Roblox cores. And this is going to be a short little overview on what you can expect in this course. The first of all, there is a low introduction included in this course, which is gonna be very, very useful. So if you've never scripted in Lua at all, I highly, highly recommend going through this. This is going to save you hours of headache because you will not be able to make proper games and Roblox if you don't know at least a little bit of loop after loop, we'll talk about the Roblox Studio. We're gonna talk about referencing parts, the different types of scripts. We're going to look at some events, some functions, or add movement. We're even going to take a look at a little bit of force and constraints when they talk about the difference between players and characters, we're going to make a leaderboard collectible parts, adding a trail to the player and a few more things. After we're done with the basics, we're going to make a custom game which is gonna be an OB, and that's gonna be really awesome as well. After the RB, I also have a few intermediate topics that we'll cover, such as publishing the game, adding GUI images, storing the data with a data storage service, and a few more things that can be very useful as well throughout the course. For every lecture, you will get an RB Excel file. So you basically didn't get a snapshot for every single lecture in terms of the scripts that we've been writing, Roblox has some pretty powerful tools for creating. So I hope you're going to enjoy the journey of making your own first Roblox game. I'll see you in the next lecture. So, yeah. 3. (Lua) Installing Roblox Studio: Alright, welcome to the Roblox course. And in this first lecture, we will be installing Roblox Studio onto your PC. If you have the roadblocks Player installed in theory, Roblox Studio should also be installed. However, if this is not the case, you can navigate to roblox.com slash create and just click on start creating. It will then check if you have Roblox Studio installed. It should then have a pop-up if it isn't stopped so that you can start it. And if you haven't installed it, then you can just download the studio. This is just an EXE file, and if you start, this will then install roadblocks onto your PC like any other program. If you're not logged in, then you will be reading with something like this. So you just put in your username and your password and login, the login and then Roblox Studio is going to start. We're just going to maximize this. And you can see, in my case, I already have some recent games, right? I already have some files, local files, and even online files for you. This is probably empty under my games. You should however, have your place. There is always a thing that exists and under new you can start a new game. Let's create a new game. Let's choose the base plate over here. And then after it is loaded, you can see it has now basically created a new place. Lots of things are popping up. I usually close the toolbox as well as the terrain editor here. And I also, I make the right and a little bit bigger. And I also go to View and turn on the output because this is actually quite important. It enables us to see certain output and we will be seeing this very shortly in the next lectures. One thing you notice you have this file with a little cloud over here. And if I press Control S, you can see it wants to save my game, but it wants to save this on the Roblox Cloud for the time being. What I suggest is not doing this. What I recommend you do is you go to File and either do save to file or save to file as because this actually makes it so that you have an RB Excel file on your local hard drive that is actually a little bit better, especially if e.g. you run into an issue, you can just share your OB Excel file and then I can take a look at it, e.g. and also you will have access, as you can probably see, to all of the OBX files that are generated through this course. So every one of the lectures has one RB exe file where all of the assets, all of the scripts that we're writing, everything is in there. And you can basically see every snapshot. Right now, even though I have this saved on the local hard drive, I still have the Cloud. We just want to close this place and they're going to file open from file. And then we're just going to open the file that we've just made. And you can see now this is absolutely only our local file. And if we were to press Control S, and it will actually save onto our hard drive again, really cool. In the upcoming lectures, we're first of all going to do a little bit of a little introduction to familiarize you with the programming language Lua. For this really we only need the Explorer and mainly the server script service, as well as the play button. If we were to press the play button, you can see that all of a sudden our game mode load and we would actually load into this game. I can now move around and I can jump. So this is basically there for you to test out your game. But like I said, all of the surrounding things, many of those buttons will not talk about them in the loo introduction. First of all, I would just want you to get a very, very solid foundation, Lord, this is extremely important. And then we're gonna make absolutely amazing things. And that's gonna be for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 4. (Lua) Variable Types in Lua: Alright, so let's continue with the Lula introduction here for the Roblox course. And in this lecture we're gonna be talking about variables. Now, variables are basically stores for certain data. But what does this all mean? Right, we've looked at a little bit of the surrounding stuff over here. And now we're gonna go in and actually create our first script and then take a look into that. We're gonna be creating those in the server script service right here. So we're just going to click on the plus and then you can see it already frequently used says script. Usually when you're creating something, you want the ones that are not greyed out, the grayed-out stuff is basically, uh, usually you don't want to create these types of parts and things inside of this container, so to speak. But we want to create a script, so we're gonna do this. It's going to immediately open the script. You can zoom in art here by holding Control and then just scrolling up with a mouse wheel, you make the smaller by scrolling down. So that is the way that you can zoom in here. That's very important as well. Another script here, I'm actually going to rename this. There's a couple of ways to do this. Right-click and you can go to Rename. You can also just press F2 and then it's going to prompt you to rename this. Or you can go, if you have the properties down here, you can just go to script right here and then just call this. We're going to call this 01 dash variables. Because this is, well, this is the first lecture, so to speak, that we're actually jumping into this. And we're going to call this variables. There you go. Now what's very important here is that it already fills in this particular thing with a print over here. So if we were to do nothing, I'm just going to delete what I had before. If we do nothing and we just hit play, right? What you find is that, well, nothing happens because right now we do not have our console. We actually do need to enable this or this. We go to View and we want to go to output. So this is our output and you can now see helloworld from, sent from the server. We're going to talk about this from this script with a name, oh, one dash variables. And from line one, if we go back to the tab over here where we have our script, we can see this is line one, beautiful. Now we can stop this and proceed. So I'm just going to re-add my comment over here. We're gonna be talking about comments and things like that a little bit more. I just want this in at the top of the specific script, just so that we know we're right now in the zero-one variables script. So the print you don't care about. So we're just going to select it, press Delete to delete that. And we're gonna be talking about variable types. Now as a high-level overview, we want variables because we want to save certain data. So maybe we want to save a number. This could be a high score, health the mount, anything like that. So we're just going to say x is equal to ten. And now in this case, every time I refer to x, this is going to represent a number. In this case, this represents an integer. An integer is just a whole number, so it's gonna be two or five, or -27. That's all fine. But if we want something like 20.8, while that is now a float, I'm going to do this 20.8, this is a float. So when declaring this, right, when we create variables, we basically want to say the name of the variables. So in this case, x then equals. This is the assignment operator, basically meaning we're assigning this value to this variable. If this is all very new to you, don't worry at all. While you're working with this, you're gonna be able to pick up more and more on what all of this means for the time being, you basically just can think about it like x is just sort of a placeholder that we put in place. And then when the code runs right, when the script is executed, then we're like, okay, with x, they actually mean ten. While we're looking at this in the future a little bit more in detail. I'm just going to print this out so you can see if we have a print and then a parentheses and we put x inside of it, right? And then the closing parenthesis, what is this going to output this, the question is this going to output X is like the letter X is going to output a ten. Well, let's just play and you will see that it outputs ten because we're outputting the value that is inside of the variable x. A good metaphor a lot of people use is that variables are basically just buckets and they contain some sort of data. There's a special type and that is called nil. This is a special type of value, and this basically represents the absence of any value, also called null in certain programming languages. In this case, it is called nil. This doesn't mean that this is zero. This means that it is nothing but another type of variable, or the Booleans. Now, booleans can either be true or false, sometimes also represented with one or zero, but they are written like this. So this is a Boolean and they can be either true or false. Now how does this look like? Well, e.g. we can say is good course and we would of course, hope that this is equal to true. And you can see that this also changes color. So basically, these are certain keywords or certain variable types. They can basically change the font color here and even marketing this as bold. We can then have another boolean, e.g. is grounded. This is something that is a little more closer to something like a game. And this could be equal to false. And you can see it also sometimes also suggests things to us. So as we type, right, what you can see, it already ordered suggest, Oh, this is supposed to be false and you can hit the tab key to autocomplete that. Lastly, we also have strings. Now we will be talking about those in a future lecture a little bit more in detail. But basically, strings are sort of like words and they are always surrounded by these quotation marks. So we can e.g. say HelloWorld. And you can see, that's all fine, even though I have a space in here because the quotation marks are surrounding it, we can save the entire word. You might come across the fact that maybe I actually want multiple lines. Those would be many words, e.g. and the way you do this is you can make open brackets and you can see the closing brackets usually generate automatically. And then here you can just type in hello, hello student, and then comma. And then you could see, I can continue writing this. I am writing because it is fun to have multiple lines regards. You go, but let us now multiple lines. And that is the general idea here, right? So to summarize here at the end, right, variables overall, our buckets of data that contains some data, and those can have different values and they can be different data types. It can contain a normal number, which is an integer. It can contain float numbers, which are numbers that have a decimal point. It could also be nu, which is the absence of any value. You can have Booleans and you can also have strengths where that was it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So yeah. 5. (Lua) Output & Comments: All right, let's continue the Lula introduction here for the roadblocks course. And in this lecture, we're going to be looking at output comments and a little bit of how to read scripts for us to start once again, in the server script service, we're going to click the little plus over here, create a new script. And we're going to rename this by pressing the F2 key. And we're going to rename this to O2 dash output comments. How about that one? There you go. And then let's see what we can do. Well, we can actually keep this print. I'm just going to actually move this down. And up here, we're going to create our comment again. So this is going to be output and comments. Beautiful. There you go. So we've seen this print before and it outputs something here down in the output. If you don't have this once again, you can go to View and enable it right here. So you can see this is now enabled because it has sort of a button background. And if it's not enabled, then it doesn't have that. So that's basically how you enable this. And there you go. If we have this inside of a script and we hit play, then what you will see down in the output and see helloworld from the server. We're going to explain this in a little bit. And then O2 output comments three. So once again, this is because this was in the third line. Let's stop this and let's continue with the script. But this is pretty cool already. And last time we talked about the idea of variables. So what if we have a health variable and that is equal to 1,000? Once again also here you can see that you don't need the spaces in-between this. So spaces are only particularly important like instead of numbers, because now the numbers are no longer connected with each other between certain operations, you can actually put as many spaces as you want. I usually don't recommend it. Either one space or zero spaces is basically the preferred way to make this readable. But yes, you can put in as many spaces as you would like. And now instead of outputting HelloWorld, what we can say is okay, the player's health, there's health is. And then the question becomes, okay, how do we, how can we then output this thousand? Of course we could be like, well, it's 1,000, that's great. But if we now change this to 500 because maybe we got hit or something, this will still say 1,000. So that doesn't quite work as we would want to if we keep this at 1,000. And we actually say, well health, right? And then it's like, well, obviously it's going to take this variable here. Well, let's just see what happens. Indeed it does not. It just says player's health is health, which of course is not quite what we had in mind here. What we want output is the value of this variable and not the name. Now, if it's inside of a string. So we talked about this before, inside of the quotation marks, then this is just read as a normal word. It's not a keyword and it's not red as a variable. But we can actually use the variables. That does work. There's two ways that we can do this. We can either do a column over here. So this is specific to the print function in this case. So after the first string, right, we can do a comma and then we can say health. You can see it actually suggested this to us. And then you just press the Tab key to autocomplete. Then we put another comma in, and then anything after that is also going to be displayed. So we can say HP, e.g. and now what is going to output is player's health is, and then whatever the mount here is saved inside of the health variable, and then HP directly after this. So let's just play and see what it outputs. And you can see player's health is 1,000 HP. Perfect. Now there's actually two spaces there. So what we can actually do, just stop this and we can even get rid of this because now in this case, this actually adds a space. This is not the only way that you can do this. We can just copy this line. So I'm just selecting it, pressing Control C and then Control V to paste it in again. And instead of doing this, we can also do dot dot and then another dot dot right here. And what this is going to do, this, this is going to concatenate this variable to the string. So this might be a little bit more complicated right now. But don't worry, we'll talk about this a little bit more in a future lecture. And also it shouldn't be too insane. Basically, we're just saying this is a string of characters. This is a string of characters. And while this is a variable, we actually just wanted to also add this to our specific string. So it's going to have almost the exact output as this. But let's just see what happens here. So if we output this, you can actually see there's no space in between because we're literally just taking the last thing that is here, right? So that is, and then we're taking whatever this variable is, whatever the actual value of this variable is, we're converting it to a string and then we're just plopping it right next to the S in this case. So here we do want a space. So if we just stop this and start this again, you can then see that the output is going to be exactly the same in this case, except for the HP. Because once again, come over here, that generates a space automatically. It has nothing to do with these spaces, by the way, don't, don't confuse yourself with this. I can just run this. So those spaces have nothing to do with it. It just has to do with the way that the whole entire thing is basically interpreted, right? So those are two ways of outputting here. In this case, a text with a variable as well, which can be insanely useful, not only for in-game purposes, but also sometimes for debugging purposes. Debugging basically referring to trying to find issues or bugs in your scripts. And that can sometimes help a lot. Lastly, we also want to talk about commons, where you've already seen the comments with the two dashes. So this is basically a one-line comment that I can make. I can just say some interesting things, right? So this could be for explaining things for yourself or others to read your scripts or things like that. Now those will only work for one line. So if I make another line here, you can see all of a sudden we're all sort of a comment. And you also don't need to add the dashes here at the end. This is a personal thing that I do, so this is not needed at all. You can also just keep it like this and everything is going to work totally fine. There's a personal quirk of mine now where you do actually need to add more of things is for a multi-line comments. So we can still do the two dashes and then we can do to open brackets. You can once again see the closing brackets generated automatically. And then inside of here, we actually have a multi-line comment. There you go. That's awesome. There you go. So you can see this is now a multi-line comment and anything in-between the brackets here is basically all we're going to be interpreted as a comment. You can even close this with the little arrow over here. So that's gonna be a little bit nicer. You can even do this. And then it's going to close it. It's going to close it like that. That's interesting. Okay, Well, there you go. That's a very interesting way of doing it. That's a multi-line comment. We've seen something similar where we will look at the back of the variables. We have seen the multiline string over here with the same idea when in this case is just gonna be with comments. But as I've already explained important note, of course, all of these scripts are always available for you for download. So the scripts are available as well as the RB XL file for each different lecture is always available for download. So you can basically check everything, look at it one for one. So if you might have a different thing that is output or something like that, you can always double-check the code, right? To summarize, once again, we can see that the print function is a way of outputting something. Usually you want to output a string, right? So if you write in print, you can see it does already suggest to it, and you can press the Tab key inside of that, you can then start typing. Now, usually you want to type in a string. So you want to start with the quotation marks and then you can just say things in there. And that is going to be output inside of the output window. And then there's also a comments. Normal comments start with dash, dash, and then whatever you want to write, this is a one-line comments. Multi-line comments work with a dash, dash and then the open brackets. Well that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So yeah. 6. (Lua) Math Operations: All right, welcome back to the loo introduction here for the Roblox course. And in this lecture, we're gonna be taking a look at math operations. So for this, once again, in the server script servers, we're gonna be creating a new script and we're going to rename it to A3 dash maths. Because why not? There you go. Now, let's then add our little nice comment over here, math operations. And let's see what kinds of math operations there are. Well, of course there is addition, that is the first one and the idea is the following, right? So we can have a sum and that could be e.g. 20. So this is just going to be once again a variable. Our 20 is the value and some is the name of the variable. And now what we can do is we can say, well, that's some should actually be 20 plus 50, e.g. now this should now be 70. So let's just take a look. So if I do another print over here, and I'm going to say sum is, let's just use this one. So we're going to say sum. There you go. So now it's going to output the sum variable. Now first, we actually do sum equals 20. Let's actually change this to ten. So there's gonna be 60 because that's going to demonstrate this a little bit better. So first, we're going to say sum is equal to 20. We say sum is equal to ten plus 50. So what it's going to come out and hear, some of you might say, well it's gonna be 20 plus ten plus 50 or something like that. Let's just play and see what happens. You can see some is 60 because the last thing that happens here is that the variable gets assigned the value of ten plus five. So this one is just ignored or overwritten because code is always evaluated from the top to the bottom. So we start at line one and it's going to go through and go through and go through. And then it's gonna be, our sum is now 20, and then the next line, our sum is now 60 because I basically evaluated this expression as ten plus 50. That's the general idea. I can also do, is I can say, well actually what I kinda wanna do is I want to have another one. So let's just say this is gonna be the second sum because, why not? And that is equal to sum plus some other amount, right? So plus 50 or plus 150 can be whatever we want. And now what is this going to be? Well, some has the value of 20. So in theory, this should be 20 plus 150, which should be 170. So if we do this, then we can see some is 20. Now you might say, wait, how is the 20? Ah, well look at this. We're outputting the sum variable and now the second sum variable. So there's always something you have to keep in mind. So once again, if I write this, you can see it already suggests this to us and then we can just press the Tab key to auto-complete. And now we're outputting the second sum variable. And now we should see that sum is 170. Now you can also see all of the other outputs down here in the output. That is totally fine and you can keep it like this. However, if this gets too cluttered for you, you can just go to the other ones and you can simply add comments over here to all of the print lines in the other scripts just so that you don't have the outputs there as well. So keep that in mind. So that is addition. Let's look at subtraction now. Can you imagine what this is going to look like? Well, let's just do a, let's just call this subtraction. And this is equal to, well, e.g. something like 25 -50. Is this going to work? This is going to be a negative number. That while, I mean, let's just see right print. And we're going to say, this is just going to be subtraction is, and then once again comma, and then we're going to put in subtraction once again, auto completing with the Tab key. Let's just let this play out and let's see what happens. And you can see subtraction is negative 25, that is absolutely no worries. Negative numbers are totally fine. So this works with negative numbers, non-negative numbers, right? We can also have 150 -50 and then it's gonna be 100. So that is really cool. The next thing is, of course, multiplication. Now this is gonna be the question mole t. Let's just call this multitask, gonna be fine. How does that work? Well, this is done with a star. So this is five-star, 40 e.g. and then it should be what should this be? 200? Yes, exactly. It's going to be 200. So this is going to be multiplication is, and then once again, just do this called multi over here. And this is going to do the exact same thing. Now once again, what I want to say here, you don't have to put spaces in-between. You can put spaces in between, but you don't have to. It is the same idea when you put the spaces in here as the space is right here. Because the idea is that this is now a multiplication operator which uses two integers in this case, you can also, of course do this. Oh, what is this going to do? Well, I mean, let's just try this. Let's just see what happens five times 40.5 is 202.5. That is absolutely correct, and that works as well. So you can also use floating numbers. It basically does that all on its own. So that's pretty cool as well. Now, division is the one thing that is a little more interesting. Division is of course, division and that is equal to e.g. 20/3. Let's just say that something like this. Okay, that's interesting. So let's do division. Is, and then let's just call this and let's see what this gets us 20/3 is I don't know. Well, it's 6.66, 666666 repeating until it runs it up to seven. So that is degenerate idea. So keep that in mind when you have things that don't go into each other perfectly. So 21/3 of course, would be seven. So if we do this, then we're just going to get seven. That's great. But if you have something that is not evenly divisible, then you will get a decimal number. And also this is very important. If we tried to divide by zero. This is a thing that you may or may not have heard before. If you do add with zero, well, you're going to get infinity. So this is a very interesting thing and this is a quirk of Lu are more or less, you can actually divide by zero. You shouldn't do. It's still like this is something that should actually not be a thing. And in this case you do get infinity. Most programming languages, usually you will get an error if this happens. So do keep that in mind. Usually you want to make sure that you don't divide by zero. But then there's another thing that might be very interesting, and that is the modal law, also called the remainder and this one, right? Let's just call this a remainder. And that is equal to, let's say e.g. the 20. And then it's going to be a percentage sign to and that is going to print the remainder. Remainder is, let's just print the remainder and let's actually see what this is going to be. And then you will pretty quickly see what this does. Let's actually do divided by three or like the remainder of three. And then you will see the remainder here is two. So the general idea is that basically just going through the actual process of division and then saying this is the remainder, I highly recommend also just checking out remainder. This is a normal thing. I think that this should be taught in math class. This should be a thing that is taught in math class. And it actually can be very, very important for certain things in programming here in this case, because if we were to do the remainder of two, so 20 modal O2, this is a way of checking whether or not a number is even or odd, because in this case it's even, right? So if we just play this, We're gonna get a zero. So we can basically say, Hey, if this number and then we do modulo two is equal to zero, we know it's an even number. And if we do, we can do any odd number, what, 21 in this case, it doesn't matter. Then we're going to get one. So if the remainder is zero, then we know in this case, if we do modal O2, so if the remainder is one with modal or two here, then we know that the number, the original number is an odd number. If it's a zero, then it is an even number of very interesting indeed, last but not least, there is something called incrementing and decrementing. This just basically says that we want to add one to a specific number. So e.g. we can have a number of cold five, right? And then in other programming languages, depending on if you have programmed before or not, you can do things like number plus plus or number minus minus. Now what you will see is that this does not work, okay? We can just comment this out, right? We're just going to say they are and then this is just gonna be like does not work because it just doesn't work. It's just something that lower does not offer us. However, there are things that we can do to increment or decrement of this number. So basically we can say number is equal to itself plus one. This is just going to take whatever number is defined as in this case five and then just adding one to it, right? So once again, this is nothing crazy, is just saying number is equal to number of plus one. So we're just taking whatever this expression is and then saving it back into number. Okay, That's fair. We can also have number plus equals one. This is doing the exact same thing. It is just a little bit more compact and written in one line. These are the exact same things they do is the exact same thing. The reason why you want to know both of them or have seen both of them, is that some people prefer to do it like this. Some people prefer to do it like this. So if you read other people's scripts, it's very important to have seen both. And then of course, the same idea goes for minus in this case. Now, you can even extend this and you can say, well what is, what about this, right? If we do times equals, absolutely number, maybe we wanna do divides equals. Does this work? That will be, I don't even know what the summer will be there, but the shore number now go crazy. Modulo equals actually, yes, we can do this as well. Now this one I've never seen like actually needed anywhere, ever. This one. There might be certain moments where this could be useful, but yeah, most of the time you're gonna be using these, maybe these three. And these two are very specific things that are very, very rare. But once again, having seen this can be very important indeed, right? To recap, math operations are just what they say on the tin, right? It is operations that perform certain math functions in this case, right? So summation just a plus symbol, a minus symbol for subtraction, a star for multiplication, and the slash for division. And in this case also the percentage for the model or the remainder. So this is just normal math. Now you might say, why do I need math in this, there are a lot of moments where you might need some math, right? So it could be the case that maybe you have a weapon and then has a certain effect multiplier for damage, and then the opposing player has certain armor. And you want to make sure that the health or the damage is generated correctly, it's calculated correctly. That's where all of the addition, subtraction, multiplication, division or that comes in. And all of it is going to be some sort of, there's gonna be some sort of some that comes out at the end. That's gonna be this, the damage. So Nath can actually be very, very important. Now those are of course just the very basics of math. But with these as building blocks, you can already built some pretty cool things wherever that is it for this lecture right here. Hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 7. (Lua) Relational & Logical Operations: Alright, welcome back to the loo introduction here for the Roblox course. And in this lecture, we're going to be taking a look at a relational and logical operators nowadays sounds very complicated, but once again, don't worry, we'll go through this first of all, it creating a new script in the server script service right here. And we're going to call it 04 dash. Let's call this relational logical. There you go. And once again, we don't need the HelloWorld where we do need is for relational and logical operators, sometimes also called relational and logical operations. Either one pretty much works. Once again, don't forget to comment out the print if you don't want to have it at the output be completely swamped with spam. And then let's think about this. So what are relational one, what are logical operators? We're, relational ones are basically, they're looking at two values and they are basically evaluating the relation between them. So this would be smaller than, bigger than smaller or equal, bigger or equal. We also have equal and also not equals. So these are the, well basically all of the relational operators and they produce a, they produce a Boolean value, right? So this once again means if you think back to the variable types, this is either true or false. Now this should be nothing insane here. Of course, if I say, well, 20, smaller or equal to 25, there is only, it can only be true or false. There's no fuzziness, right? There's not like one. If it's 50 per cent small, that, that's not what we're talking about. We're just saying, hey, is this smaller than this, or is this equal than this? And that is the general idea. And logical operators are operators that take two Boolean values and they will evaluate those. Those are end OR and the NOT operator in this case are, those are the really important ones. There are some other ones as well. If you are really interested in this, you can look up Boolean algebra. That's basically the term to take a look at. And that basically gets us a little bit more into it. But for the time being, we're not too concerned with it. So when we think about this, we can say a test, e.g. here is three, smaller than 20. This is of course true in our case. We can just print this out, right? So let's just say is three smaller than 20? And we're just gonna print this out. We're going to print out test over here. There you go. But let's just play this and see what happens. And it's going to print out true because it's three, indeed is smaller than 20. That's very interesting indeed, you can see this, evaluates this expression and makes it a Boolean in this case true. Now we can also say, let's say tests here again, that's gonna be fine. This is 20 is bigger than 200. This of course will be false. And then we're just gonna do is we're just going to select this press control C, gotten going go here, press Control V to paste it back in. And then we're just changing this. Is 20 bigger than 200 because now we're saying 2020 bigger than 200, which of course is false. Let's just let this play again. And we will see is 20 bigger than 200 is false. That is exactly right because this is not the case. Those are the examples of bigger. And then the same idea applies for smaller equals, right? Then it's just going to be also true if it's equal. And then if this would be equal, right? This now would be false. Right? Should make sense because, well, 20 is not smaller than 20 is equal to 20. If we were to do this, all of a sudden it becomes true again. Hopefully that makes sense here in this case. Now when it comes to the equals operator, Let's e.g. say we have a string, one which is going to be hello, and then we have a string too, which is called also hello. Why not? There you go. Then we do a comparison of this. Why not comparison? This is equal to, and then we say string one equal two equals signs. This is the relational equals operator which looks at these two strings, right? And puts out a Boolean value. This is the assignment operator, very, very easy to mistake one for the other. But what you should get is you can see you will get an error if you have a only one. So this red underline here, basically you see, it's like, oh, this doesn't make any sense for me. Absolutely no worries. Two equals signs is the relational operator. One equals sign is the assignment operator. Very, very important. Now print, let's just print this and let's just print the comparison. And we should get in theory a true, right? So we're going to have a, the first printout, is this true, the second is false. And then here we're just going to have a norm, just a true output. Let's just see. And we're going to see true, absolutely amazing. So that definitely works. Now, if I change anything in here, it even the casing, because now these are no longer exactly equals. So what it's going to happen false because in this case, both of these are not equal because the casing is always taken into account because this is a different character and therefore they're not exactly equal. But this would be one of those things. And don't do this. This is just an example here. So you, for you to sort of understand this. This is sort of what you would do, right? When you have a password and you're like, okay, this is whatever the person has. Typed in, and this is the password that I stored, red. Are those equal? And then only if it's true, then you're going to let them in. Now, don't do this, don't save passwords like this. That's something that should be done by only by advanced people. Very, very much so just for you to get thinking about this, okay, this is one of those ways where you could see a comparison be important. Now when it comes to the logical operators, it gets a little more complicated here, because here we actually want to take multiple Boolean values and put them into like put them next to each other. And they then sort of, you know, this is a logical extension for this. So e.g. what you could do is, let's say x is equal to comparison. So it's going to take the comparison value here, which is in this case it's going to be true. And then we can put an and operator in here. And then the second value has to be another Boolean. So e.g. we could say, let's just get to test in here, right? So now it's going to say, well, if the string's match and the test is true, then x is going to be true, right? So in this case, comparison is going to be true and test is gonna be false, right? So this is currently what happens here, right? Because test here is false. So if we now were to print out x is just for the sake of argument x right here or there you go. If we do this extra be false and you can see x is false. Why is this the case? Well, because the end operator says that both Boolean values have to be true for the entire expression to be true. Now once again, if this is a little bit complicated for you at the moment, absolutely no worries. This is a thing that you just have to play around with a little bit. So what I highly recommend you do is you open up this relational logical script over here and you just play around with this. What's even crazier is you can put this on as often as you want. So I can say End true. And maybe another one we want to say, well, 20 is bigger or equal to 50, something like that, right? So you can see, you can chain those together as much as you want. Once again, it might be a little bit complicated. It is about testing this out and trying out a few things with us, right? I'm just going to copy this over and I'm also going to make an OR operator over here. So this is going to be, now it's going to be true or false. What happens with the or means that either one or both of them have to be true for the output to be true. So in this case, true or false just means comparison is true. And then we don't even care what about the rest because one of them is true. This is going to be true. So we can see, Let's just say X1 and X2, just so that we understand that the difference is here. And if we play this, you can see x2 is true because here we are using the or operator and that only cares if one of them is true and then the whole expression is true. Like I said, it's not really an advanced thing, is just one of those things that's not really taught early on in school. Is it basically just formal logic? There's nothing crazy about this. And even though it might sound a little bit intimidating, it actually isn't. Once again, just sit down with it a little bit, play around with this a little bit and you will find that this actually isn't that crazy. Now one last thing, Let's just take the comparison over here as well. And then what we're going to say is that actually we want to negate this. This means that this is actually not a test. Now, this might be like the FREC is this, this is pretty crazy. Well, we're basically negating this false or we're flipping it. So negating simply means that we're flipping it from a false to a true. Or if this was already true then to a false. So sometimes you will see this written like this with an exclamation mark in the front. But in this just means that this whole thing is true, right? So this is now all of a sudden not false, which will be equal to true, right? Let me do this. So this becomes a little bit more clear, right? So we're negating the test that whatever is written in the test variable, in this case false. And we're flipping it to true. Once again, if you don't get this immediately, just play around with this a little bit. I highly recommend you really want to just type stuff out and print stuff out and then sort of get a little bit going with this and then be like, Okay, now you get it because actually applying this is way more important than just listening to me, like explain this like ten times. It's better for you to sit down and be like, okay, the x is this and then the y is this, and then it's like n naught, and then just print it out. But for the sake of argument, let's just see x3 is going to be true. And you will find X3 indeed is true. Because once again, comparison is true and the opposite of test is also true. Therefore, this is true. As a quick recap, your relational and logical operators are all about Boolean values. And basically our operations that compare two values, two or more values in some cases, and give you a Boolean value from that, right, either a true or false. There's smaller than, bigger than equals, not equals, and also the logical operators AND, OR and NOT in this case, these simple operations actually are everything that the computer does like. When you go down to the lowest of low is where all of the ones and zeros that you might have heard about before. This is all they use and, or. And then some relational operators, that's all they use, nothing else. So with this comes great power actually like, as in programming, this is why they are quite important. Once again, here at the end, I wanted to basically give you the impetus to say, okay, really sit down for a good ten, 20 min and just test out like on how these work. If you have not understood them, if you understood them, absolutely great. I was still implore you to just try them out a little bit if you have not understood them, try it out again. I highly, highly recommend if of course any questions remain, don't hesitate to ask. Otherwise it's going to be this for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 8. (Lua) If and Else Statements: Alright, welcome back to the little introduction here for the roadblocks course. And in this lecture we're gonna be taking a look at if and else statements. So now we're really getting into the meat of this. Once again, in the server script servers, let's create a new script and we're going to rename it off five dash if and else. How about that? There you go. I'm well, once again, I'm going to do all five if and else. Now if and else statements are very, very interesting indeed, let's suppose what we have e.g. is we might have a gold amount that's gonna be 100. And then maybe we have a, maybe you have a grade and that's going to be let's say we just barely passed 65, something like that. And then we also have a Boolean value. And that's gonna be, is, of course good. And that is going to be equal to true. Let's just suppose that that's the case. Now the thing we can do with if else statements is we can basically sort of interrupt the flow from top to bottom and say, Okay, if something is true, then do this. Or if something else is true, then do this. So e.g. we can say if is coarse Good, You can see it suggests this was uneven, tells us this is a Boolean. So we're going to hit the Tab key to autocomplete. We then say, then, once we press the Enter key, the end over here generates automatically. And now this is extremely important. You can see that our cursor right here is actually indented. So this is the same as if I were to press the Tab key and you can see the same indent happens here. And then this is just automatically because right now we're inside of this if statement. And you have to actually be cognizant of the indent writing it like this. So I can write stuff here. I don t think it technically is wrong, but it looks very strange. So you basically, once you're inside of an if statement or a function which we're going to see later and things like that. You always have an indent and yes, if I would have another if inside of here, instead of that, if we would indent another type for the sake of argument, let's just continue with this. So this is going to print something and it's going to produce Brent. Yeah, it's a pretty good course. So there you go. So as long as is course good is true, we're going to print this out. Let's just play this for the sake of argument. It is true. So, yeah, it's a pretty, it's a pretty good course. Well, let's just make sure that it also says it's a pretty good course. But now we're going to say false. Let's just solve this isn't the case, but if it might be, we're going to play and we have no output. Because in this case, everything between then and end will only get executed if this true. And now we're really starting to stack on those different tools. This is basically each one of those lectures. It's another tool in your toolkit that you need in order for you to understand the basics that come later with everything roadblocks. And this is one of the biggest and most important ones, if and then else statements. So e.g. we could also think about something like this. Let's say let's just add another one over here. This might be something like the toll. So maybe right where you want to cross the bridge and the total is 150 gold. So what we can e.g. say is, well, if our goal that we have is bigger or equal than the toll, right? Then we can say print, player might pass. But maybe we want to be like, well actually we don't want to end here. So we can replace this end with an else. And then once again you can see it's an else. If I just hit the tap kick, I can auto-complete and I hit Enter, it then generates another end over here. So we can say if gold is bigger than the toll, than the player might pass. And if this is not the case, then we can say player is not allowed to pass, right? So then we can just hit play. And we can see, if we look at this, player is not allowed to pass because gold is actually smaller than the top right. We only have 100 gold, but we need 150. Therefore, this gets printed out. So everything in the else gets printed out. If this is false and everything here gets printed out if this is true, we can also do something like this, right? So we can say, this is now a very crude way of doing it, but it is true, right? So we can say current gold, let's say Gold is gonna be Armor, Gold, right? So just put outputs, the gold as well. And what we can do is if we pass, well, we actually want to do gold minus equals whatever the total is, only if we actually successfully pass, because otherwise we actually don't wanna do it. So now let's just see what is the goal after we do we evaluate this? Well, it's going to be, well, 100, right? Because we haven't paid anything. Because indeed we can pay because our toll is, well, it's 150 here and we can't even do anything. I'm going to make this one-step more complicated, but you will understand this location, let's just say home, right? So we're home right now. And if we pass, let's just say We're gonna be downtown. Let's just say for the sake of argument, if we don't pass, well, we don't even need to change the location, so we can say current gold. Let's just copy this and then we can say current location. Then we can also print out the location. Okay, Let's just play this once again. And then we'll see, right, we're still home and we still have 100 gold. But now what if I change the toll right now? It actually costs 69 to pass? What's going to happen now? Well now our gold is bigger or equal than the toll, meaning that we are allowed to pass. Our location is going to change to downtown and we're going to subtract whatever goal we have, like the toll from our God. So let's play this and let's see, and all of a sudden we can see we now have 31 gold and we are downtown. Now this is of course, nothing in the game itself has changed. We've only changed one or two variables in this case. But maybe you can already see how incredibly powerful this is to have these if statements and you can chain them together. You can put another if statement in here. There's all sorts of things that you can do, which is really, really awesome. This is really one of the things that is, I mean, it's just really cool to see this sort of thing come to life. Hopefully this is a really illustrative example of this because they've statements and the if else statements are really, really awesome. Now, let's say once again, the last thing. So we have a grade over here and let's say e.g. we want to check, okay, it has this person pass. So we can say if screen is bigger or equal to 50, e.g. then we're just going to say, actually, let's do it the other way round. So let's say if it's smaller than 50, then we're going to print a fail, right? Because then we've failed. Now we're going to replace this with an else. But you know what Actually, when it replaces with an else, if because I want to check whether or not the grade bigger or equal to 50 and it is also smaller. So great is smaller than 100 them. Then I want to do something specific. And then I want another else, because you can chain them as much as you want. And then this is gonna do something else. So this is going to be printing, let's say passed over here, that's great. And then here, if you get 100, right, so this would happen if you get 100 or above. But let's just think about that for a moment. But if we have 100 or more, then we're going to say they passed with honors. Because why not, right? Because that's really cool. So right now we got a 65 for the grade. So we should see past B output. Let's see if this works. And you can see past is indeed output. That's really good. Let's stop it and then go back here and actually change this to, let's say 100. Now we should pass with on us. Let's see. Let's play this. And we can see passed with honors. That's great. We can even go a step further. Let's just say for the sake of argument, we want to add another one in here. What we can do is we can add another else if, and we can say if greatest, bigger than 100. Now let's, let's do it like this. Let's say else if great is equal to 100, then we do this, right? And then we're going to do another else. And that's basically going to be, if it's anything but 100, and then we can say more, more than 100 is not possible. You cheated. So something like this, more than 100 is not possible you cheated. And now if I were to do 101, all of a sudden, we're gonna get more than 100 is not possible. You cheated. So if you don't quite understand the logic through this, just think about this, right? What is grade right now? Great as 101. Is this smaller than 50? Not 101 is not smaller than 50. Therefore, we go to the else if, now we're checking, is it bigger or equal than 50? It is indeed bigger or equal than 50. But this also has to be true because we're using the logical operator AND right, so both of these things have to be true for the entire statement to be true. And because great is bigger than 100, we're going to the else if now we're looking Great, equal to 100, it is not equal to 100, it is indeed 101. Therefore, we're going to the else over here. And because we don't have an if statement, we're just saying, okay, now we're using the L, so everything in here gets executed, meaning this gets printed out. Well, I hope that those are some interesting examples of if and else statements, how you can use them and why they are. So actually really, really awesome. You can see like we already, we almost made a tiny little game over here just with one if else statements with a gold, with a toll. And that is really awesome already, right, for a tiny recap once again, if and else statements use boolean values to evaluate something, right? They can use a normal Boolean value. You can use the relational and logical operators to chain those Booleans together. As we have seen in multiple ways, we can use if and else if and else statements to chain those if statements together. And then everything inside of that if statement is executed. If the Boolean expression is true, really a very cool thing. And I once again, only highly recommend playing around with this a little bit on your own time. It is really, really awesome. Well that is it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 9. (Lua) Local Variables: All right, welcome back to the loo introduction here for the Roblox course. And then this short lecture, we're gonna be talking about local variables. So for this, once again, in the server script service, let's create a new script and we're going to call this 06 dash local. And this is of course also going to have a common O6 local variables. Now, this is not an insanely important topic. However, I did want to, we'll basically talk about it once. So local variables before when we had a variable, we just did x equals, I don't know, like 100 and that was it. Now, we can also put the keyword local in front of it. And you can see, you can see that it's a keyword because it gets bold and also red. So now we can say local y, e.g. is 50. Now why would this be important or why not? Well, the general idea is that a local variable basically makes it so that it restricts it where it is accessible. Right now in this case, we actually, it doesn't matter because we can just do print x and that everything's gonna be fine and print y and everything's going to be fine. So both of those are just going to work. Let's say we have an if statement and we're just going to say x is, let's say bigger than five, and then we wanna do something. Now, if instead of that, if someone, let's say this is statement is really complicated, really complex, and we actually need some variables inside of it to function. We could say something like e.g. z equals 100. That works. And we can then use this here and whatever we wanna do. And the crazy thing is we can then even use this Z outside of this if statement. So you can see the Z here is accessible outside of this if statement, but this is not always what we want because number one, this can confuse the person using this, right? So maybe we actually don't want this. Z is only usable in this if statement. And after this, whatever it becomes, whatever value it has is not even representative of anything that we want. This could be the case. If this is the case, then e.g. we can make it local. And you can see what happens is this now has a red underline, meaning and error. You can see alone global z, because normally variables are global variables. But in this case, we're explicitly saying this is a local variable and is only accessible within this particular context. The context being the if statement. So if, if it ends the first n-tier, the end for this if statement basically also deletes quote-unquote, this local variable. Overall, it is a normal thing to basically make everything local except if there are moments where, oh, you know what, actually this shouldn't be local. In theory, what you should do is every time you make a variable, always just start with a local And that's, and then you're gonna be fine, and then you're gonna be okay. Because there are very few instances where this is not the case. And you can see if it isn't right, if you then want to continue working with this, then it's totally fine, then you can leave this out. But usually you want to make them local and then you're gonna be fine. Another additional reason why you want to do this is just because they're a little bit more performance. Now to be fair on modern machines, this is probably not going to do like a lot of difference here, but just in case it can be quite important. And if you see the local on other people's scripts, then just know, usually you want to use them for all of your variables except for in very, in some circumstances where global ones are needed, then you can keep it out. Usually when I instantiate a variable with local in front of it, right? So I just made sure that the prince over here are commented out because of this print, of course, which throws an error while we have a local variable. But overall in, to summarize here, once again, local variables, they make a little bit faster and they restrict the scope where a particular variable is accessible. Not making a global makes it a little bit tight, easier for people to use your scripts. And also it makes the game just run a little bit faster. Might be miniscule changes here, but usually you want to use local whenever possible. That's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 10. (Lua) String Operations: Alright, welcome back to the Roblox course. And in this lecture we're going to be taking a look at string operations, of course, first of all, in the server script servers, let's create a new script over here, and let's rename it to 07 and dash string operations. And of course, once again, we're gonna do an 07 string operations, Ahmed over here, and then let's begin. So we can make a new variable. Let's just call it a test and we're going to call it something like hello there, I am saying hello, and that is a string. And we've seen this previously. We can e.g. print this out with the printf function putting in tests right here. And that is going to, of course, then output the value of the test variable in this case. For this, we need the output over here and also making sure that in the old ones and make sure to comment out the print functions in the old scripts as well. And if we have the output window open and the print over here, then let's just play and we should be able to see hello there. I am saying hello, well that's pretty good. Now why am I writing something so weird in there? Well, because we're going to see something interesting in a moment. But the first thing we can do with a string is figure out how long the string is. Because maybe sometimes we want to do that. So we can figure out the length of a string by doing the following. What we can do is we can say hashtag test, and that is going to output the length of this particular string. So it's just going to count how many characters there are, including spaces. So before we're going to output this, let's actually count 1, 234-567-8910, 1112, 1314, 1516 1718 1920 201-20-2203, 2420, 5206, 2728, 2930. In theory, this test variable, this string right here, should be three characters long. So our print over here should turn out length of a string, 30. Let's play and see if this is indeed IT. And length of a string is 30. Nice. This is already pretty cool, but what other things can we do? Well, there are a whole host of different things. So let's say we make a new variable. What we're gonna do is we're going to type in string and you can see it actually starts suggesting this to us, and it also marks this as blue. So it is a keyword in this case, and we can put a dot after it. And then you can see we have different functions that we can call. And those basically represent a certain thing that they do with certain things. So e.g. here returns the length of the string. So instead of doing the hashtag, you can also do string that Lynn Wright and then put the string in there. Very important. So we can do this. And in this case the new test is actually going to be the length. Let's just call this length for a moment. Let's copy this just as a test. And we can then put in length right here. And if we play this, we're going to see 30.30 because it's basically doing the exact same thing. But this is one of the operations that we can do. So usually most of the operations for strings in this case always proceed with string dot and then sort of function basically. Let's do a new test and let's take a look. So string that. And you can see there's a bunch of stuff. So you can see this concatenates n copies of the same string. This is basically just if you have, if I put the string in there and I put three in there, then it's gonna be hello there. I'm saying hello. Hello there, I'm saying hello, hello there, I'm saying hello. So this is basically just to repeat the same thing. Sup is. This is a substring and this is similar to what we are going to see in a moment. The description here. It can be a little bit complicated, but don't worry about it. Byte is usually something we don't really need. But what I do highly recommend is you can always take a look at each of these functions and we'll basically just click on them and then you can see a pretty good description and you can even click Learn more to learn more. What we're gonna do here is we're going to do g sub, g sub. This looks crazy complicated, but it actually isn't. So let's just double-click on this. It's going to format all of this correctly and we're just going to put in the test string comma. And then this is a pattern. We want to look at this pattern. So e.g. hello. And we want to replace it with something. And in this case we're just going to replace it with a normal string. And this string is just gonna be Howdy. So what do you expect to happen here if we now output new test, right? So if we were to print new test, right? So this new variable, what is going to have G sub, hopefully what it's going to do is going to take the test variable right here. And it's going to look for the word hello, right? And it's going to return a copy in which every time hello comes up, it's going to be replacing that with Howdy. So if we were to print out new test, well, hopefully what we're going to find is it's going to say, how are you there? I am saying Howdy? Let's play and see if this is indeed what happens. And this is indeed what happens. How are you there? I am saying howdy? Now what is extremely important if I were to also print out the original test right here, right, because we have put this into the function and we've replaced the hello with a Howdy, you will find that test has not changed. So you can see test is completely unchanged. And this is also what it says. If I just stop here, it is also what I said. If we go in here, it returns a copy of the string that has passed in. So it, it does not modify the string that we have passed in. That's very important to remember. Another thing I can show you is e.g. finding something. So this is going to be string dot find. So this is another method that's actually took a look at what it says. So looks for the first match of the pattern and then returns the indices. Okay? So what does that mean? Well, let's just put in e.g. test over here. It doesn't matter which one we put in. And then I can say there, so we're going to take a look at there. And then we can also print this out. So where is we're gonna do it like this there and then output finding. And we should get a number out of this so you can see where is there seven, okay, so why is it at seven? Well, if we count once again, right, so I'm counting the characters to my right, So it's gonna be 1234567. So this is indeed the seventh character, or it is the character with indices or index of seven. That's the general idea. And then to fund things that you can use if you sometimes, it's interesting and that is basically shouting case and then whispering case. So the idea is that string dot upper, and if we put something in there, and then we can just copy this. So just selected Control C, Control V to paste it in. And this is then whispering and this is then lower. What you will find is that the upper, It's just going to see returns a string with all lowercase characters change to uppercase, while lower here returns a copy with all uppercase letters to lowercase. So if we do this, you can see shouting hello there, I am saying hello and then every spring is like. So those are pretty cool as well. Now these operations, including some of the other functions for strings, can be incredibly useful if you have any sort of texts that you need to modify based on maybe the location of the player or you need to output something somewhere. So this can be basically used for a whole lot of things. That is why it can be quite important. And of course, as always, I highly recommend playing around with this a little bit. There are of course, a few more string functions that you can use. But in conclusion, you can get the length of a string by either doing hashtag than the string variable or you can also use the string functions from string dot and then whatever the function is in this case Len. We've also seen how you can replace things in strings and always remember that this returns a copy of the original string is never changed. We can even find things and strings and at the end here we also seen changing lowercase and uppercase characters as well. Well, I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 11. (Lua) Loops in Lua: Welcome back to the loo introduction here for the roadblocks cores. And then this lecture we're gonna be taking a look at loops. Now, what are loops? Well, they are very interesting. First of all, of course, a new script over here, 08 dash loops and a nice comment at the top here as well. And the question is, what are loops? Well, well what if I gave you the task to print out every number 1-100? You could say, well, okay, let's just start right. We're gonna do one and then we're going to copy this. I'm going to say 23 and 4.5, and at some point you're done. Now I'm going to say, well, actually, what I would like you to do is every even number should actually not be printed. I only want the odd numbers, 1-100 and you're gonna be like, Wow, that's kind of annoying. So you're going to either a comment out every even number or you're just going to delete every even number, then I'm like, Oh, sorry, I read this wrong. I actually wanted the other way around. I actually didn't want to print out the odd numbers. I actually wanted to not print out the odd numbers and you're like, Oh my God, I just changed everything. And at that point you're just going to be very annoyed. Of course, this is not the way to do it. There's a far easier way to do it. That is, loops, basically loops in a very overview term, or certain pieces of code or certain pieces of script that are going to repeat x amount of times, however many times you basically want. So e.g. we can make a for-loop. You can see this already suggests you can make a for loop and this already is being highlighted as a keyword. And the way that this works is I'm going to write this out and I'm going to explain. So we can say I is equal to one and I'm going to say ten, and I'm going to say comma again and then one and then do. And as soon as I press the Enter key right here, you can see that the end degenerates and everything inside of this for-loop, similar to what we've seen if statements, right? Everything instead of this for loop is going to be done in this case ten times. Now how is this? How does this work? What does this craziness mean? Well, this means the following. It means that the loop, we need to start counting of course, because we need to know how often are we going through. Whatever we put in here, we can just print out i in this case, right? So we're going to just print out the number that we're counting. And the question is, okay, we started one will start at one, meant by this, right? So we're starting at one, okay, that should be fairly self-explanatory. Started one. Now we're going to end at ten. This is what this number means, and then it's extremely potent. This number means that we're increasing the count by one every time we finished the loop. We could also do three. So then we're increasing the count by three or two or six or nine or honored 26 if we wanted to, we can do a lot of stuff with this. But for the time being, we're just going through this. And every time we go through this print, we're increasing this I by one. And as soon as it reaches ten, we are done with this. Well, let's play and see what happens. And you will be able to see if we expand the output just a little bit. 1 234-567-8910, exactly what we would have expected. But we're increasing this I by one every time we finished a loop. So we're starting over here. We're like, Okay, I is one right now. The rest doesn't concern us at the moment because I is not ten or it's smaller than ten. So we're like, we're totally fine. And then we're printing out I, which is indeed one. We're getting to the end. So we're going back to the for-loop. We're like, okay, now I is increased by one, so now I is two, and so on and so on and so on until we reach ten. And then the loop is like, Oh, look at this. I is now ten. So we're done. And that is what's called a for-loop in this case. Very interesting indeed. Now we can also have a different type of loop. Let me just stop the game for a moment. And we can have a different type of flu and that is a while loop. So e.g. we can have a local variable x over here, that's three. And then we can say while, and we can say while x is smaller or equal to ten, then we're going to do something it will have in series you get an explicit boolean expression that has to be true. And while this is true, we're going to do this now while loops are notoriously prone with the following thing, and that is an infinite loop. Infinite loop happens if, for whatever reason, you never get to falsify this. So if x is always smaller or equal to ten, then this while loop is going go, going to go forever. Now I believe, if I recall correctly, Lula and in addition, Roblox Studio have sort of a built-in fail-safe for this, so that your entire Roblox Studio won't crash if this happens. But I still recommend you don t try this out because it is kind of annoying. So inside of here we can e.g. say, okay, we're just going to increase x by one every time and then we should be totally fine because of course, if we increase this by one, at some point is going to be bigger than x, right? So if we can just say print and that's actually also print out x, y naught would be the case. And let's do it before we increase it though. So we're going to print out three all the way until ten. And then we should also be outside of the loop. So let's just make another print over here outside the loop. And let's play this and let's see what happens here. And of course, 3-10, where outside the loop, absolutely no worries. We can also do, and this is just an example here. Inside of it. If we're inside of a while loop or a for loop for that matter. Right? Let's say we want to be like, Okay, you know what? When x reaches seven, then we actually want to do the following and we're gonna break. Break is another keyword which is going to completely immediately break out of the loop as if we have reached the end of the loop. And that doesn't mean we reach this end. We're like we're outside of the little bird jumping out. We can also use continue. And this would act as if we have reached the end over here. So this will continue the loop. This will break the loop. This will basically we're outside of the loop at that point. That is the general idea. So if we use break here, then we're going to have three to seven output. You can, or in this case six actually because we're outputting x before we increase it. So x is six, it gets, it gets increased to seven. X7, we're breaking out and that's why we have 345.6. And then we're outside the loop. If we were to do a continue here, what would happen is actually nothing would be different than we had before because nothing after this if statement is relevant. However, if we were to put it at the very beginning over here, now it will be interesting because now it's seven wouldn't be output. So if we see this right now, you can see all of a sudden, what would happen is we would run into an infinite loop. Now this is of course, app. So you can see we've exhausted the allowed execution time because what happens here is that x is seven and then we're like, okay, let's continue and then it's like exercise. Let's continue, Let's continue, Let's continue, Let's continue, Let's continue. And it's going to do this until, in this case, allowed execution time is achieved. That is 10 s, if we can see this right, so the difference here in time is 10 s. So in theory, this can happen. So this is why you should be careful with this. So we could e.g. do something like this. So the print happens afterwards and then what the increase here happens before. So if we were to do with this, then all of a sudden we jump 6-8 and we jump over seven in this case. So that is another interesting idea. And then also we have a repeat loop, which is pretty much a very similar thing to the while loop. What we're basically doing it the opposite way around. So we're basically saying, Hey, we want to repeat the following code until something is true. That's pretty much, it's almost equivalent to the while loop, but it's a little bit different. And that is written like this. That is pretty much everything about loops. Or they can be interesting. That should be pretty much there is to it, right? In summary, loops are incredibly easy and efficient way to repeat code that you want to repeat it x amount of times there are for loops, while loops and repeat until loops. And those are the, I think the three main versions. There's also some interesting stuff for, for loops later that we can see all four each loops. But overall, those are basically the big three. And they can be very, very interesting indeed. So I do highly recommend playing around with this a little bit. If you want a little bit of a challenge, this is just a challenge for yourself. What you can do is you can increase this to 100 and print out numbers 1-100 and then do exactly what I told you to and basically say, Hey, we only want to print out numbers if they are divisible by two. So if the, if there are even or if there aren't. So this should be actually fairly straightforward with the if and else lecture and the loops lecture, you should be able to do that. I highly recommend you try this out. It is a very fun exercise. Regardless of that, I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 12. (Lua) Functions in Lua: Alright, welcome back to the loo or introduction here for the roadblocks course. And in this lecture, we're going to be taking a look at functions. So I have set this word a couple of times. Let's create a new script over here and rename it to 09 dash functions, and of course also 09 functions right here. Now the question is, what are functions? Well, as a high, high, high level overview, you can basically put multiple instructions instead of a function and then always execute that function instead of doing all of these different things as a high-level example, we can write a function. You can see this is a keyword and then this is the name of the function. Let's just call this cooking, right? And then we can even put something in here so we write the name of this function and then we have parenthesis. As soon as you put in the open parenthesis, the closing one should generate automatically. And here you can then put in certain arguments. Those are called parameters, are parameters and they can be passed into the function, thus changing the output. So in our coding example here, Let's just put nothing in here and actually just actually just go to the end, press Enter, and then the end here, we'll once again generate automatically. This is the same thing that we've seen with the loops and the if and else statements as well. And inside of here, if we're cooking something, I can now put different things. Now, in this case, it's not going to work. I'm just going to do comments just so that you get the idea of a function. What is a function, right? So every time we want to cook, maybe we actually want to cook something specific. So let's just say, let's just say we're going to call this cook dinner for the sake of argument, right? And every time I want to cook dinner, There's a few things I have to do, right? So I have to get out cutlery, I have to maybe preheat the oven. I have to make a cut vegetables, things like that. So there are certain things that I always have to do if I want to do this specific function, right? This specific thing. And you can list all of them inside of a function. And then instead of writing each one individually, if we were to do this multiple times, we would always have to read each and every instruction. And that's madness. Basically a function is a container in which you can put multiple different lines here in this case, and they will then get executed. Now this is a high-level example for you to get the idea. Hopefully. Now let's actually take a look at an actual example. So one actual example could be a sum function. We are inside of the parenthesis. We put actually number one and num two. And now the crazy thing is, if we were to call this num function, we actually want something returned. So we can say return. And you can see this is also a keyword and we want to return num one plus num two. And this is now what is being returned. Now of course, in this case, we already have sort of some function by just using the plus operator. However, this is once again, just as an example for you to start to understand functions and why they can be extremely useful. Because now what we can do is we can print and we can say, well the sum function, right? And we can just print some and then say 3.10. And this is, as you can see, this is, we're calling the sum function. You can even see that it highlights over here. If I click on this and inside of here, we can pass in a one number and another number, and those gets summed here. So these are parameters that we're passing in parameters, you always have to have the correct amount of parameters. So if we do, if I were to do this, then while we're not getting any issues here, if I actually were to run this, we would get an issue. But for the sake of argument, let's just play this. And we will see that if I look into the output, we attempted to perform an add on a number of nil because if I don't pass in something right, then what is passed in is nil. Now we've heard this before, right? Nil, it was just the absence of any value in a certain variable. So we do have to pass something in. And if we were to pass in both numbers over here, then we will be able to find that the sum function outputs 13, which is exactly what we would expect here. Now of course, when you're actually scripting something, functions can get much more complicated than this, but this is just a very, very tiny introduction into functions. We will be seeing those when we're actually doing some programming with Roblox itself. To summarize over here, functions you can basically use to batch together multiple different things and have them all executed one after the other. This can also include other functions. You can also return to certain things and functions. E.g. we have a sum function here where we pass in two parameters. And those are then going to be returned after we are doing something with them. That is a general look at functions. If you're not entirely sure how to use them, don't worry, the most important thing is that you have been introduced to this topic and we will be able to see more about functions in later lectures as well. Otherwise, I hope you found this useful and you learned something new. I'll see you in the next lecture. So, yeah. 13. (Lua) Tables in Lua: Alright, welcome back to the loo introduction here for the robot scores than this lecture, we're gonna be taking a look at the tables. Now, tables are a very interesting thing and they can be quite complicated, but don't worry at all, we will be fine. So let's do tables over here and hash tables, and then the same thing over here. And this is tables are tables. The general idea of tables is basically that you have sort of a list of certain things. So when, of course, a table is a little bit different than a list, but you can, for now think of it as a list and so that we have something to test. I'm gonna make a local variable called days. And these days, this is going to be a list of all the days from Monday to Friday. First of all, What we're gonna do is equal to and then a curly bracket, the closing curly bracket generates automatically again. And this is going to be a table of strings in this case. So this is gonna be Monday comma, and then we have Tuesday. And can you guess what comes next exactly? Witnesses day, which is how it's written Thursday and then last but not least, we also have Friday. There you go. So this is basically, well, these are the days and we can now do the following. We can print, right? And what we can print is we can print a day. And the day we're going to print is we're going to print well, how about we wanted to print out, let's say Wednesday. How do we do this? Well, let's think about this day so we can put in days and you can see it even suggest this to us. And now how do we actually get out one of our deaths? Well, we have this bracket over here and insight we can put in a number. And that number represents the index of one side of the list, right? So this is gonna be the element of index one and X2 and X3 and X4 and X5. But everyone, Wednesday, we're gonna do three and let's just play and see if we get out Wednesday and indeed a day, Wednesday, that is pretty awesome already. Now, the index here starts at one instead of zero. So this is only important if you are already programming and if you've programmed before, usually when you do other things in other languages and other programming languages, usually indices start at zero. This is not the case in Lua. In Lua, every index starts at one. This is very important. Now if you don't know what any of this means, don't worry about it. That's fine. I'm just saying that for people who have already programmed before, this is a very, very important thing to keep in mind. Now of course we have output one, but what if we maybe want to, we'll output everything. So this will look a little bit more complicated, but we have a for-loop that we can use that will basically output, well, everything inside of this particular table. Now, there's two different things that we can do. We can either use a normal for-loop right where we are like, Hey, I want to start at one and I want to stop at. This is a very important hashtag days. So this would be the length of this particular table. Like how many elements are in this table? I want to increase by one. For this I wanna do and then just print days. Once again brackets. I saw this in theory should output Monday, Tuesday, Wednesday, Thursday, Friday. That should be totally fine. Let's just see if this works. And of course, Monday, Tuesday, Wednesday, Thursday, Friday. Absolutely, no worries. And it works totally fine. This pretty cool. There's a second way that we can do this. This totally works, but there's another way that we can do this. Now this one, a little bit more complicated. The reason though that the other one might be interesting is because right now the tables are mapped to the index. So basically this is red, this is one, this is two, this is three, this is four, this is five. In theory, I could do anything I want. So I could do, and I'm just gonna, I'm just gonna do crazy stuff. Let's just say a equal to this is equal to this, C is equal to this, d is equal to this, and then F is equal to this. F is E. Actually, there you go. So you can see that there's no, No, there are no errors over here because now they're mapped to different keys, right? So now the crazy thing is if I were to keep this and I'm playing this, what you will find is that a day is nil. And also we're not outputting anything because there's no, This is all nil. It, this doesn't work. But this well we need to do is we need to get the key value pair. Because we've basically transformed this table from a normal list in which you can access the elements via the index to a sort of a dictionary or a map which maps one value to another value. So now we can do a for-loop with a key and a value, and this is going to be in pairs of the days table. Then we're gonna do something. But this looks pretty crazy. The general idea, however, is this, this is the new thing. What we're taking is we're getting a key that is always the first thing here, right? So a is equal, this is the key and the value is whatever is written inside of it, right? So before the key was just the index 1,234.5. And now the key is a, B, C, D, and E. This is the only thing that changed. And if we were to do the following, if we now do day or let's say, let's say key. And then we're going to print out the key. And I'm going to do the value and then print out the value. What you will find is that this will output key value Monday and so on and so forth. But let's just play this. You will see key a value Monday, key C is Wednesday, interestingly enough, and this is also a very important thing. It is no longer in order. Isn't that crazy? Well, this is indeed the case. So let's just play this again. As we see we had Monday, Wednesday, Tuesday, Friday, Thursday. Let's do this again and we get the same order again. This is another extremely important lesson because if we're using this pairs right here, the order that we've saved this in is not guaranteed. That's extremely important and has to be basically kept in mind. However, it is still a very, very interesting thing. But do keep this in mind, it's very cool. And if I were to delete the value of the keys over here again, right? And we were to go through this again. What is going to be the key? Well, it is exactly 12345. Now the order is correct because I don't quote me on this. I'm not 100% sure, but I'm pretty sure that the keys are sortable or orderable, right? So 1234, there's a definite order to those things, then the order is always going to be the way that you've basically save them. And that is pretty cool. Indeed. This is not everything though, because what is missing in these days? Well, of course, Saturday and Sunday are missing. So what we can do is we can actually insert certain values into this table. We can do table dot and you can see there's a bunch of things that we can do, we can create, we can find certain things. We can even see returns the maximum numeric key. There's crazy stuff. We can move, things, we can sort them, we can clone them. But for our purposes, what I actually want is I just want to insert something. And the thing I want to insert is I want to insert into days. So this is the table that we want to insert into. Then we need to put in the specific, in this case, what I actually wanna do is I want to put this into a specific place. So I'm going to put this into position number six. And then I want to put in the value. And the value here is Saturday. And what we can do is we can just copy this. And then in position seven in this case, I want to put in Sunday. And if we were to output this now, so once again, I can just take whatever I like. Actually, let's just take this one and then we'll just go delete it from here. That's gonna be okay So that we don't span the output over here. Let's play, and you will find that now we have a key six and that is going to return the value of Saturday and a key seven that is going to return the value of Sunday. Very interesting indeed. And then one last thing here. Now I know that this has been quite a lot and this is a lot of new things at all at once. Don't worry at all. We're going to be able to, you know, you're gonna be able to navigate through this with ease a little bit later. However, this, what I do always recommend as always is just try out a bunch of things with this. Try out. Having different values in here by having instead of strings, you can put numbers in here. And by the way, this is also really interesting thing. You can even put, you can mix and match different value of variable types. You can have numbers in here and so on and so forth. Which is actually very interesting because this means that you can have a quasi class. Now, this is a little bit more advanced and once again, something for the people who have already programmed in another language. So you can have, so e.g. we can have a person that has a firstName, e.g. john. And it can have a last name, which is maybe Smith. And then you can even have an h, right? Which is maybe a 32. And now what I can do is I can print person, person. And then we want to put in FirstName, this y. And then we want to have the person. We can also do person dot, and this is crazy. We can even do person dot. And you can see all three different things that we've put into this particular table. We can output like this. So we can do lastname and then we can say, is that we can say Person.new age, years old. Let me zoom out a little bit. There you go. So person and what? It's going to output the person's first name. This is the way that we can write us. We can also access this by this. And we just have is and then the age, years old. Let's output this LLS play this and see if this works. And of course, her son John Smith is 32 years old. Absolutely fricking, awesome. This is really cool and we can of course go a little bit further. And now this is just, I just want to mention this. We can even make a table of tables. This means that in theory, we can have multiple persons and then have a list of those persons. We're not gonna do this here because that is absolutely madness. This is way beyond the scope of the Lula introduction here. I did want to introduce you to tables. They can be quite complicated. This can be a little bit complicated. This can be a little bit complicated. But hopefully I was able to nudge you into the direction of sort of understanding what's happening here. Once again, I highly recommend taking the script over here, which is of course always available for download. And you can take this and just try around. Try doing different things with it, inserting things in different locations, inserting things laying around that the person over here. I highly recommend just doing that and trying to get a feel for how this works. But once again, to summarize overall tables, or they can be lists of things that have certain keys and certain values. If you don't specify the keys, then the keys are just one through whatever the amount of elements are inside of that table or list in this case. And you can loop through them with two different for-loops, two different styles of for-loops. And that is very, very cool indeed. We can even use the tables to do something sort of like a class. Now in this case, it is a person over here that has a first last name and an age. And we can output this in two different ways. Well, that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 14. (Lua) The Math Library in Lua: All right, welcome back to the loo introduction here for the roadblocks cores. And in this lecture we're gonna be talking about the math library, right? So let's once again, of course, create our script over here, 11. This is gonna be math liberal. There you go. And this is going to be 11 math, that's gonna be fine. And this is just going to be a very, very tiny introduction here. But it might be useful. So we've of course done a few math things already, right? We've added, we've subtracted, we've multiplied, we divided, and we even got the remainder. Pretty freaking crazy things that we've already done. But with the math library we can do even crazier things. So if we were to print e.g. minus five, but we're like, You know what? Actually, I don't really care about whether or not it's minus five or plus five. I actually just want the absolute number for this. Well, we can just print out math dot. And you can see here all of the crazy things that we can basically get with this math library. We can get a random number. We're going to see that in a moment. We can even get Pi craziness. We can do the exponent, we get cosine, we can returns an angle which you give in radians and it turns it into degrees. We get the logarithm. There are a lot of things, as you can clearly see that we can do. And this can be extremely useful for doing even more mathematical things. If you're like, Oh, I don't need this math stuff. Well, e.g. having things like the sine wave is actually really useful. Because what you can do with a sign is e.g. make perfect circles and so you can spoil things in circles. I'm just saying that that is one of the things that, where this can be extremely useful. But in this case we actually want abs, which stands for absolute. So we're getting the absolute value of minus five, which if we just play this is of course five, because, well, that's the absolute value. The absolute value doesn't care about the sign. It just cares about, well, what is the actual value? There's other things that we can do. So e.g. we can do a math teal. So this is going to be the ceiling. You can see it returns the smallest integer, larger than or equal to x. What does that mean? Okay, This sounds like, it sounds way crazier than actually is. If we put in 10.21, It's just going to return, well, it's going to seal. So it's going to actually make this an integer, meaning this is going to round upwards to the next whole number. If we actually do the other one which is going to be floor, this is going to round down. So we can actually put this up, rounds up and this one rounds down, dual. Keep in mind, this does not round with the normal rounding things, right? So we also have round. This one, in this case also runs down because it's actually looking right. Or the rule right? 0.5 means you round up and everything below 0.5, you round down. But let's just see, this should be 111010. Uh, see if that is indeed the case. And of course, 111010. Perfect. And let's stop this and let's do this again with 0.5 and then it should be 111011. And of course, 111011, exactly how we got there. They're absolutely perfect. This is exactly how this works because this is the, let's say, normal rounding rules. There you go. So that should hopefully make sense. We can also get the minimum and the maximum. So this is also, can be pretty useful in deed. So this is min, which is basically, it's going to give you the minimum number. You put in two numbers, right? And it returns a smaller number given as r Omega. So that should make a lot of sense. And then of course we can have two corollary to that, which is the max one, which returns biggest number. You can actually, I'm pretty sure, put in as many numbers as you want. Let's just do that. Why not 60? I mean, that wouldn't change anything one, this in theory should also work. Let's just see. And indeed it does. The first one is one and the second one is 515. So this can be really useful, e.g. maybe you want to get the highest number for a high score or something like that, the Min and max functions can be really useful. But let's also print out pi because white hat and not power but pi. And then also we can use the square root math that SQRT is the square root of 25. So pi is of course going to be 3.141, 5265, something like that. And then square root of 25 should be five. Let's see, how far off was I with pi? 314-15-9265? I think I was right. I think I said 649. I'm not sure, but that basically is pi. And this is of course with precision, that is amine. Never going to need this precision in games anyway, I'm pretty sure that this is the precision that you're gonna get you, the circumference of the observable universe within millimeters. So I'm pretty sure this is gonna be fine. And then of course, the square root of 25 is five. Perfect Last one leaves. You can also have some randomness. Now here is very important that randomness for the computer is always pseudo-random. Basically, this means you seed it with a certain value. And when you generate numbers that are always going to be the same, this is the same. The idea of e.g. when you think about Minecraft world generation as an example, you can put it in a seed and then it always generates the same world. Well, how does that work? This is exactly the seed that you're putting in. And then the values that you get out are always the same. So we can do a random, this is going to give you a number, number 0-1. And you can also do math dot random. And we can actually put stuff in there. So we can put in a 0.10 and those are going to be the lower and upper bounds that you can get. So let's just play this and we can see that the first number is 0.6, whatever, whatever, whatever, whatever, and then 42. I mean, what a perfect number over here to get n. If we stop this and we play this again, where you will find is that, oh, it's exactly the same numbers because, and this is exactly the thing, because the seed is the same, right? So we have the same random seed over here. If I change this, now we're going to get completely different numbers. So you can see now we get 0.0, 69.57. So when you put it in the seed, right, if you put in 100 as well, you should in theory get the exact same numbers that I got. And that is, that is the idea of this randomness or the pseudo-randomness. That is pretty cool indeed, usually if you want to randomize this completely, what do you take is the like the amount of seconds on your computer or the amount of ticks on your computer, because that usually is random enough for a seed. To summarize. Overall, the math functions are, well, there are plentiful and they can get you a lot of different things. You can absolute numbers, you can round up and down. You can get minimax, and you can even get some constants like pi here and even random numbers which end games are extremely useful. And they can just, they can help you a lot for a number of different things. It's morning enemies in a certain area that's a little bit random or giving random attributes to enemies. All sorts of things. Really cool indeed, right? But that actually concludes this lecture and also the entire lower introduction. Hopefully this was a good enough introduction for you to get a little bit of grips on here with Laura. If you are still not feeling very confident in this, that's totally fine. There's two things that I can definitely recommend. Number one, if there's certain topics that we've discussed that you're a little bit shaky on, tried to go through the lecture again and see if with all of the different things we've talked about so far in retrospect, they are now a little bit easier to understand. Number two, what I highly recommend is just play around with these, with the different topics that we've gotten. Just play around a little bit with the math functions over here, play around with tables, play around with loops, and if and else statements. You can already do a lot of things with just these 11 things that we've talked about. Even though it might not seem like a lot. I'm telling you, these are the basis in which everything, every game basically is created with all of these basics. Yes, of course, there's a lot of other things as well. But these basics, if you can't use those, then everything else is irrelevant because you need to know the basics, the fundamentals. Otherwise, it just doesn't work well. In regards to this, we're jumping into roadblocks proper if this has been useful to you so far, I would really appreciate a review from you. Otherwise, I'll see you in the next lecture. So, yeah. 15. (Roblox) Roblox Studio Explained: All right, welcome back to the Roblox scores. In this lecture, we're gonna be taking a look at some of the UI of Roblox Studio. Now this is just going to give you a general overview, will not go into every single button and what everything does, because that would take a two-hour video basically. And that is not quite what I had in mind. I just wanted to show you each of the different windows over here and roughly what they do. So either this or maybe without the output is going to be roughly what you will see when you open Roblox Studio for the first time with a custom game, the first thing that I really want you to do is go to view and add the output over here, because the output is one of the most important things that we'll use throughout the entire course, because it basically allows us to output anything that we want through scripts. And this is where this is going to be displayed. Then let's focus on this big area right here, which is sort of the camera view. And you can see right now I'm in select mode. There's also move mode, scale mode, and rotate mode. Let's say in select mode. And if I were to right-click on this, now I can move around if I move the camera, but I can zoom in with the scrolling the mouse wheel. And if I do left-click, I can actually select certain things. So you can see now there's a blue border around it, meaning I have selected this object. This is the general idea. I can also move around with WASD and with E and queue up, it goes up and down. You can see when I move the camera on the top right, the cube over here moves as well, because this is a three-dimensional space, it is represented with an x value, a y value, and a z value of this is just a three-dimensional coordinate system. I can click on the faces over here and then it's going to change to that face. So I can go to the top-down view. And now I have everything in top-down view. It might be useful for certain things, but I can also always rotate out of it. If I select a certain object, you can see it lights up in the Explorer on the right, right, so you can see the small location over here is then highlighted. And the general idea is that I can also just click on this and then it also gets highlighted. So this idea of the explorer. The explorer represents everything that is inside of our game, both inside of the game world. The game world is all of the workspace stuff, right? So if I were to click on the plus over here, I could add a bunch of things over here. We're not going to add anything right now, but I could add an insane amount of things. This is basically all that we see. And then there's also other things, right? So there's a player's lighting services, some storage stuff. Some things will go through most of these things during the lectures as well. But for the time being, the workspace is really the most important thing that we have. And maybe the server script service, where we will basically load in all of our scripts for the time being. Then on the bottom right, when we have selected something, we can see we have some properties. Properties represent a certain object, right? So in this case, this particular spawn location has these particular properties, just like how you are human, right? And you have a certain name that would be a property, just as a general idea. And you can see different types of objects have different types of properties. So in this case, the spawn location is of type spawn location and it has some data. So you can see these are what is its pen orange or does this name has a size? So this is part of the transform and has a pivot, it has some certain behavior, it has collisions, it has some port properties, and so on and so forth. It even has a force field which is specific to the spawn locations. Same with the teams, I'm pretty sure. So there's a bunch of stuff and you can even add more attributes over here. So very, very interesting. Indeed, properties are something that we will look at in a future lecture as well. And then to just give a little bit of an overview as well. So if we select this and now we can change to move mode, and now we can move this around. So you can see I can now move this. I can also scale it. I can see the scales that basically if we hold Shift, then we scale it evenly. If we hold control and we scale it in one axis, we can even rotate it around like this. And if you want this to snap, then you could do this in the rotate in the move over here, snap to grid, and then now I can only rotate it 45 degrees. I can only move it in a one-star increments. That is the general idea right here. Most of this other stuff we will see throughout the course as well. The transform might still be some interesting things. So if we select the spa location again, you can see this is not the transform on here. We can go into way more detail on how to do certain things. So you can see, I just have like much finer control of everything, especially when I size this up. You can see now the size of the study is actually represented over here in numbers, which is really awesome. So I can get really, really precise with things avatar of the current moment. We don't really need anything here. So this is just to add avatars, in this case, testing, just to test certain things right here. From here we can play, we can start a local server with x amount of players. We can even change the player emulator. It's very interesting. The view is actually quite important because here we can enable and disable certain windows. And as you can see, there's actually quite a few of the asset manager and we have the toolbox, and we have the object browser, and the script analysis and the command bar. So there's a bunch of things here, most of which we actually don't need right now at all. Most of the interesting stuff is maybe the toolbox is gonna be interesting. So this is where you can load certain things from Roblox into your game, right? So you can add lights, you can even add some plugins in this case, right? So you can add plugins. Some of them cost, some Roebuck, some of them do not. Some of them are free. Do always be wary though, when you add stuff from other people that they might have malicious code in their malicious scripts. That does exist. Mostly this is for things that are free. Do always take a look at how many reviews they have and also how many positive reviews that are half, right? So something that's like 91% positive and has like 100 plus reviews, that's probably gonna be fine. So do keep that in mind and we can close this. You can add a grid that is now a force that grid that we can make a two sort of grid or a 16th note grid as well. This just helps you to see what is happening. Wireframe rendering just basically turns off all of the solids, just gives you a wireframe of everything. This can save some amount of processing power of your PC is very slow basically. And then here the plug-ins for the time being, we will not use any plugins for the lecture series, because usually we can do almost everything that we need manually or ourselves. However, there are some pretty freaking cool plug-ins that are available. But for the time being, we won't be focusing on that, right? And that is a general overview. Like I said, we could go into crazy detail on all sorts of things for the time being, we're gonna be fine with this. And we will then basically go from here and take one step at a time. But that's gonna be it for this lecture right here until next time. So, yeah. 16. (Roblox) Reference a Part: All right, welcome back to the Roblox basics here for the robotics course. And in this lecture we're going to be taking a look at parts and how to reference them. So what are parts while pores are everything that exists in the workspace, so to speak. So if we click on this part right here, you can see we're creating a new port. We can delete this again. We can also go to the plus on the workspace and we can go down all the way to port or we can just put in part and you can see part and then it also creates a new part for us is we have this port. We can now drag this around and move this around. And we can do all the things that we've seen so far, right? We can move around and we can scale this port. We can make this bigger, we can make this smaller. We can move this about. So there's a lot of things that we can do with this particular port. And it's gonna be very interesting indeed now this one is called port. And what we might want to do is we might want to reference this inside of a script, right? So there's a bunch of ways that we can do this. For the time being. We're going to create almost all of our scripts instead of the server script service, which is going to make this a, well, a server script, right? This is only going to be executed on the server. The differences between servers and clients will talk about this a little more in the future years as a tiny overview in general, the server is basically what Roblox controls. That's like somewhere on a server, somewhere on Roblox land, that you have nothing to do with that. You are the client, so your PC is the client. When you connect to a game, you connect to one of those servers and your client obviously can't do everything, right? So the client can change the number of coins that you have. Because if you were to able to do that, you could just like press a button or make a custom script and you're like, Oh, I have 1,000 coins and then the servers like yeah, absolutely. You have 1,000 coins. So there has to be a decoupling regardless of that, right now, sort of a script service. We're going to create a new script, m going to call this. We're going to pick on this F2 O2 dash, and we'll call this the reference. Ligo will zoom into this once again and we will call this are referencing a part in workspace. This is going to be very interesting indeed. So there's a couple of things that we can do. So let's say we want to reference the base plate. We can do this. Let's just make a local variable base plate and that is equal to game. So we always want to start with game lowercase. Very important that, and now you can see I'm getting everything that is instead of here. So basically game is the root of the explorer. You can see I get players, which is this guy over here. I get workspace with this guy. And there's a bunch of other things now, I wonder if you have a workspace. Once again, very important. The casing is important here. Always keep that in mind. Workspace with a lowercase w might look like it might work, but it will not work. So keep that in mind. Always make sure the casing is correct. That and now all of a sudden, you can see there's a bunch of things, but there's also camera, which is right here. And there's part one. Look at this. This is cool part, is this the same port? Indeed it is. And the name here has to match exactly. If I rename this, if I click on this, press F2 and rename this to port lowercase p. This will no longer work. Now, you can even see, it suggests to us a port with lowercase because that is the name of the part that we're referencing. It has to match exactly. I know that I'm harping on this point, but it is extremely important because I've seen this time and time again that people have just changed the casing. The casing is important. Okay, So now we're referencing the part with lowercase p, right? Okay, that's fine. As a base plate, that's not what we want. We actually want to reference the base plates. So basically, there you go. I can autocomplete this with tab. Now I've referenced the base plate. I can do things with it. Well, okay. But what about my part that I want to reference? Well, we're going to say local again. And then let's call it my part as is just the name of the variable, which is different from the name of the object of the part. This is also very important. This is what is represented. Insert the code while this is the actual physical object part. And once again, we're going to say game workspace and then port, not parent. Actually, we want to park. There you go. And now we can do things with a port because the part has different types of properties. We can change those properties from inside the script. So we can say my part, which is the variable pointing to this particular part. That, and now you can see I can change the position, I can change the name, the rotation, the color. In our case, we're just going to change the transparency to 0.5. And then we'll also do my part dot dot color. And then we can change this to a color three dot nu. And then we'll just do something like while we can actually just change the color right here. So let's just pick like a nice blue. Yeah, that's nice. So this is just automatically generating those colors. You can see if I click onto the height of this, if I click on Saturday, as you can see, the color right here, and you can click on the color wheel to change the color, which is very, very cool indeed. Now what is going to happen when we actually start the game? Well, Let's just go into the game view. We overhear the port right now it looks completely normal, but if I start the game, this should be transparent by 50 per cent. So it should be 50% transparent and it should turn blue. Let's just play the game and let's see where instead of the game. And if I go around here, you can see it is now a little bit transparent and it is blue, exactly what we wanted. If we go into the workspace, we can even see the part over here. It now has a different color and the transparency is 0.5. Pretty cool indeed, I can see when we're no longer playing the game, it basically resets to its original properties in this case, because changing them instead of the script, it doesn't change them permanently. So that would be one way of referencing a part in a workspace via the name over here. Now once again, it is extremely important that if I change the names here to e.g. my cool part right? Now, if I were to play this now, what would you think happens? Well, we're referencing something that's called part. Let's just play. And we will see that part is not a valid member of works or does not develop member of workspace. Workspace and it has not changed its color nor its transparency because now the part is called Mike cool part. So keep that in mind. If you get this error right here, it simply means that you probably are referencing something that has a name changed. If we make sure that we're doing this, all of a sudden, if we play this, now we can see we're not getting any errors. And once again, we get our blue part that is transparent. Pretty cool indeed, right, to summarize, as I've said, makes sure to name the things correctly. You can use game dot workspace dot, whatever the name of your port is that you want to reference. Make sure that these make sure that the casing is always correct. And then you can access the properties by doing your part variable dot. And then you can access all sorts of properties that are part of this particular part. And you can change them with a script, but that's gonna be it for this lecture right here. Hope you found this useful and the alerts and the new one, I'll see you all in the next lecture. So, yeah. 17. (Roblox) Types of Scripts: Let's continue with the roadblocks basics here follow Roblox course and in this lecture we're gonna be taking a look at the different types of scripts. So we have previously seen this already when we make a new script in the server script service, it is basically frequently use says Script and module script. There is, however, another type of script. If we just type this in here, you're going to see that there also is a local script. Normal script sadly, apparently does not have a tool tip, however, the local script does. So you can see a local script is a script that runs on the client and not on the servers. So the logo scripts can be placed under the following things. A player's backpack, player's character model, a use the GUI, the player script, and the replicated first service, the module script, right, is a script fragment and it only runs when other scripts use the Requires on it. So that's an interesting one. And the script, well, that's just a normal script. So far we've been using normal scripts under the server script service. And this then has been run both on the server and the client. That's the general idea. Now there are some things that you only want on the client to happen. Those are mainly things that are basically client's specific. So maybe visuals, right? Maybe you want to add visuals to a certain client. That's pretty much something you wanna do on the client. Local scripts or client scripts. They can communicate with a server through a remote events. But that is a very more like intermediate, advanced topic that we'll not talk about right now. But the general idea is that yes, we can have local scripts. So if we were to, once again, take a look at where we can add this, a backpack, a character model, a GYE, a player scripts will replicate first service. So what we can do is we can add this to the replicated first. You can see it even says, Hey, local script. And if we were to do this, and we will just say print, print, Hello, World is actually totally fine. Let's rename this and I'll say O3 local script in this case. And then just a local script example in this case, we're just going to print out hello world, and we're going to see if we play this, it is going to be output. But now, and this is a crucial thing. We now get client over here. So this is what we did not have before, right? We now actually get something output from the client. And this is extremely important if we were to just go into the referencing one over here and we're to make a print HelloWorld, just the same thing, just for the sake of argument and we play this. You're going to see that is now on the server. You can see there you go. So HelloWorld is on the server from O2 referencing line eight and the other one, right, the HelloWorld, this one is from the client or three local script to write. Now you might say, well, what's the freaking difference, right? There's nothing crazy going on. Well, right now this is my client and I can actually switch to the server and the server. The server basically controls everything, right? So the server in theory, I could just say, Hey, you know what, no, I'm going to move my guy over here and I'm just going to move him. Now, you can move yourself by the normal movement rules. But if you were to try and change your position from the client, only, that that doesn't work because that would be that's where anti cheating stuff comes in. So client-server separation is very important. So that is basically the general idea with a local script comes in. And like I said, you can communicate with the server, but that's something for a intermediate level. And then a module script is a little more complicated. So we're just going to make a module script O3 test module here. In this case, let's actually call this testimonial. There you go. So in the module script, the general idea is to put functions or certain, basically functions that you're going to use a lot of times, right? So different multipliers, different bonus functions, some calculations that you might be using. A lot of times what you can use is you can make a new function. And the way to do it is we're gonna take this table over here. I'm going to say module. So this is the name of the table that sum. So this is going to be the name of the method and then whatever we want. So basically we're just gonna make a sum method again and we're going to return this case, not repeat, we're going to return x plus y. So once again, this is just an example. Write a sum method. You really wouldn't make a custom module script for it, but just so that you see, okay, this is how you would make a method in a module script and then reference it later. So if we have this, we can now in the server script, servers once again make a normal script and we'll call this 03 dash testing modules. Why not? That's okay. There you go. And what we're gonna do is we need to now somehow connect this module script to this particular script. The way to do it is we need to use the require method over here, but we actually want to do is make a local variable. So let's just call this the summation. Sure, and this is equal to the required method. And then we need to reference the module script. So this is game dot server script service and then.o3 tests module exactly like that. And then it actually will represent it like this because we can start a reference of a dot with a number, but that's fine. We can use it like this, That's okay. And then we can say, let's print this out. So let's print summation dot and you can see it now even tells us, hey sum, we can use this press Tab to auto-complete and we can say 50.23 shirt. Why not? So this would be 73 that we're printing out here. So let's play. And we're going to see that the server prints out 73 right here. Pretty awesome indeed. And of course this is once again, just an example. The idea here is that you know, if you have certain, if you have certain numbers, right? So you could add things like a, you know, you could add different tables. You could add maybe there's like an experience, experience multiplier or something like that, right? And then you could just add a new table and you'd be like, you know, maybe easy, you get more experience, right? So then you get like 25 points. More experienced, medium, you get like a normal experience. And then on hard maybe you get less experience. This is just once again, like just an example of what you could use here. Now, this one would not only be available in the module, this is extremely important because now it's a local variable, right? Let's just take a look. If we were to print out the summation R and we would try to use this. We wouldn't be able to do that. We only use some over here, which is interesting. Now, if we were to do not local, what would happen now? Do you think that we will now be able to use this? Well, let's just take a look, right, summation that we still are not able to use this, because to use this, we will need to do module dot. And now all of a sudden it's sort of added to this particular a table. And now if we go in here, all of a sudden we have, we have the experience multiplier available to us that is really awesome and it can basically, I mean, it just makes so much sense, right? You could store all a lot of things instead of modules, scripts that you're going to use in, well, in all different scripts. Maybe a special player names that maybe certain things for connecting to certain services later down the line. So a module script extremely, extremely useful for a lot of things. And just to show you, you can see summation experience, multiplier medium. If you were to print this out, then we would get a one or here because that is exactly the medium that we've defined right here. Now that is pretty awesome indeed. So to summarize, there are three types of different scripts that are local scripts that run only on the client. Then there are normal scripts that can run both on the server and the client, and they sort of synchronous automatically. And then there are also modules, scripts which are used to store variables or functions that you will be able to use anywhere in your code. And that basically helps you to not repeat yourself. Anyway, I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 18. (Roblox) Properties Overview: Let's continue with the roadblocks beginner portion of the roadblocks course. And in this lecture we're going to be taking a look at the properties. So we're going to make a deep dive into the properties. So let's just expand this window and let's just take our cool part and take a look at all the crazy different properties that we have available. So the first one is the brick color in general, the brick color and the color, or almost the same thing. So if we choose a different brick color here, let's say like a dark blue, you can see that the color here changes. And the general idea of bricolage just they are predefined colors that are easy to use. While the color can be like literally any color, right? If I just choose a random color over here, it's not going to have a name. So you can see it does say it's like brown, yellowish green. So it's going to approximate to this one, but it is not exactly that color, right? So you can see this one is all love. And then I don't know this one is olivine, but if I were to change the numbers here a little bit, right, It's not going to change too much in its appearance, right? Maybe this is going to be like a two over here. And then it's gonna be a sand violet. But you can see that it's, it's not exactly in here. It is just similar to where's the sand, violet. I have no idea. I can't find it. Well anyway, that's the general idea, right? So you can put a number here. So this would be a hex, right? Something like that. So now it's black metallic, but that is not really black mentality. You can see this color and this color, they are not the same. So it is the general idea of the brick color and the color when it comes to casting shadows, that should be fairly self-explanatory. Right now casts a shadow and now it does not. That's, that's pretty much all there is to it, the material. So you can choose different types of material. So certain materials have certain properties to them. So you can choose metal e.g. which is gonna be a little bit reflective light. So you can see this now really does look a lot like metal. Plastic was just going to be nothing. So if we choose glass, right, it is not 100% translucent because of course the transparency is not there. But if we were to make this transparent, now it would have like a glass Shine n would be transparent as well. Pretty cool. And so there are a bunch of different materials that you can choose. Plastic is just the normal one with no real texture to it, right? So the material variant in this case, we do not have any material variance and I'm actually not even sure which one of the materials does have one. We can go to the material manager up here and we can actually take a look at all of the materials that are, that exists over here. Force field, e.g. we could choose the force field. So this is how the force field would look like. And then we can go in here and we can choose the force field, e.g. force field. And now this is a force-field. So you can see it's very see-through from all sides. So that's interesting indeed. And there's a bunch of other things. We've got metal over here, different types of metal, diamond plate foil, corrodes. Metal is really awesome that you can just with some of this stuff, right? If we chose corrode metal e.g. if they can see the color here changes what changes in the texture itself, right? So now you can see like the color here is like the base color. If we were to choose this red, then all of a sudden it gets red, green, stuff like that. So it is really cool what you can like change here, and it's really awesome. So highly recommend playing around with this a little bit and getting a feel for this brick is also pretty cool and you get a brick texture just on top of it. Pretty awesome indeed, red reflectance and transparency. We've talked about this before, right? Reflectance just basically makes the actual thing more reflected. Now you can see that this is dependent on the material because now the brick material, they actually cannot be reflected. If we were to change back to plastic, which can be basically anything that you want, we can make this as reflected as you want. 100% would literally be, it reflects all light. So now it has a, now it's a mirror, right? And that's perfectly reflecting this. But because our script makes the transparency 0.5, we actually don't want that. And now we have a mirror again. Now you can see it does not mirror the player. That will be way too intensive for a lot of the processing. But that is the general idea for the reflectance and then transparency. We've seen this already, basically how transparent at this particular part is. So archival, a very important thing about all of the different properties. And this is actually very important. You can hover over this and it is going to give you a short description of what this particular thing does. So you can see archival basically it's just like, Is this going to be saved here? Then we have a class name that is locked usually because in this case this is a port. We can also make this locked. Then if we make this lock, then we can actually move it anymore. So if we lock this and now I can't even like I can't even try to select this anymore. And now I can go back in here and I can unlock it, and now I can select it again, I can move it again. Very interesting. Indeed, the name here and the parent should be fairly self-explanatory. And then these ones are usually also non-changeable. However, the size is changeable, so maybe we want to size it up, maybe do 758, maybe something that's not too. There you go. So that's pretty cool. So you can see that now it is sized up and we can also change the position. So when we change the position, you can see the position on both the origin as well as the C frame changes. So you can do this manually as well. So I could do -25.20 again, and you can see now it moved and that is pretty cool. Now the origin point is basically, you can hover over this, right? This contains the information of the position and the matrix of the rotation. You can change this and you can read from it. The origin, if you ever though this, this is basically where this rotates around. So the general idea is if I rotate it, it rotates around a certain point in space and you can see it points, it rotates around the exact middle of this particular part, right? However, if I were to change the position of the origin, Let's just take control Z to make the rotation zero again, if I were to change this to 000 right here, right? Now, the thing actually comes with it. That's not what we want. We want to offset the pivot, right? So now if we were to offset the pivot by 20 minus five and -20, that will be what we want to offset it by. All of a sudden, the pivot is at zeros, zeros. So you can see now the position is 00 because we've offset the pivot. And if I were to rotate, we would now rotate around this particular position. So now we rotate around this. So that's pretty cool actually, because what you can do is you can offset it. And if you would e.g. want to have a spinning platform, well, they can just change the, change the rotation here and now you all of a sudden you have a spinning platform. You can go crazy like a distances. But yeah, that is really cool and can be used for a lot of different things. In this case, can collide and can touch should be fairly self-explanatory, right? It's just whether or not a physical interaction can happen in here, can touch. Basically if the Touched event is called on this, there's also different collisions groups that you can define. An anchored means that it doesn't, that is not affected by gravity. So if we were to have this, Let's go and put this up in the air and it's not anchored. If we play, it's going to fall down onto the ground. So we can actually see this. So you can see it's now on the ground, even though we put it up in the air. And if we were to anchor this right, if we go down over here and anchor this, then is going to mean that it's going to stay at that particular position and not be affected by gravity. So you can see now it is in the air. Pretty cool, right? Custom physical properties, massless, things like that. Usually I recommend staying a little bit away from those because then you get into crazy stuff, right? The custom physical properties you can see, you can change the friction, the elasticity, the density. So there are some cool things that you can do with it. But this is definitely a little more for intermediate and advanced users, right? And the rest with I wouldn't mess with for the time being. However, you could always hover over things and take a look at what the different properties basically mean. And now those are, of course, properties that are specific to a part depending on what you're creating here. If we click create a texture or D cow, or a dialogue rate or a proximity prompt. All of those crazy things, those are all going to have different properties. However, you must think, simply realize that a property is nothing else like a variable or an attribute attached to a certain object. In this case, it shouldn't really be anything crazy. But if you have a property, it's something like spawn rate, e.g. could be a custom property as well. And then you would be like, oh, that's probably a number that has a certain relationship to A's to the spawn rate of a certain thing, right? So this is the properties overview can be really useful and really cool to play around with this a little bit. And then you will see that there's a lot of things that you can do with properties and even custom properties, which we'll see later down the line to summarize, every one of your objects that exists has properties. Some of them are properties that all of the different things share. Like if this is a thing instead of 3D space, it always has a C frame and an origin, meaning and a size. So this is basically the transform signifying the actual position of the object in 3D space. And there's other things like collisions, things that are descending from part can also be anchored massless, all sorts of things. So there's a bunch of properties that exist. I highly recommend playing around with this a little bit, just adding a new port, playing around with some of the properties that exist here. And you can even add your own attributes for the time being. We won't venture into that just now. But suffice to say with properties, you could do a lot of cool things. Alright, that's gonna be it for this lecture right here, or we found this useful and learned something new. I'll see you all in the next lecture. So, yeah. 19. (Roblox) Vector3 and Position: All right, Welcome to the Roblox basics for the Roblox course. And in this lecture we're gonna be talking about vectors and changing the position of a part. So we talked about referencing parts before. We have talked about modules, scripts, and we've talked about the properties. And now let's actually change those properties properly inside of a script. So let's make a new script over here. It needs server script service. Let's call it 05 dash positions. And then let's see. So we'll call this the vector three and positions. Comment over here and then we will talk about what that is. So first of all, let's actually get our part. So that is going to be, my part over here is going to be equal to game workspace, my cool part. So we've seen this previously in the referencing lecture. So that shouldn't be anything crazy. And now what we can do my part and now we can change what I mean pretty much all of the different properties that are in there, including some some things that are like a lightning bolt here. And we even have these weird like file cabinet type things. For the time being, we're only going to use the blue cubes and e.g. the position you can see this is of type vector three, and this describes the position of this part inside of the world. Currently, if we just do this and we just print this out just for the sake of argument. Let's just print this out. We should get a vector and that is -21.8 and so on and so forth to 0.4, 99.1, 17.93. So that is basically this position. And if I were to change it, nothing's going to change in the output because we're only outputting at once. So if I go into the position here and I will do 50, 50, 50, like the actual position will change. So now it's over there. But it wouldn't update the output because while this was already output and we're only outputting it once, that's fair enough. What if we were to change this position, right? So what if we output the position and then we're saying y part that position, and then we want to change this. How do we change this? Well, we change this by giving it a new vector three, right? So we want to say vector three dot menu. And then here we put an X number, a number, and a Z number. Now the important thing here is that a vector three, write a vector. Maybe you've had this in mathematics. Maybe you've had this in mathematics overall. It is very easy to understand. What do you probably have seen before is, let's do something like this. So you probably have seen a two-dimensional grid before with a y-axis and an x-axis, right? And on that, you can describe every single point with two numbers. Now it's the same thing in three directions, just as another direction, right? So this position, like we've seen before, is let's just make this a little bit nicer. 2015 and -17 for the sake of argument, right? So now it's over here and we can now change this position by just giving it different coordinates. So let's say instead of -21, we're going to have, let's do 50, 50, 50 again. And this is now anchored the parts, so it's going to stay in the air. So what we would expect to find is this outputs -20, 15, -17, then we're going to change the position to 50, 50, 50. So when we actually load into the game, even though this outputs the old numbers, this is now changed to 50, 50, 50. And we can confirm this, we're just going down and we can see position is 50, 50, 50. Very interesting indeed, but we can only change that. We can of course change, I mean, pretty much all of it. We can even change the rotation, which also is a vector three. Now, there's some interesting stuff concerning the rotation in three-dimensional space. For the time being, we're just going to do the vector over here. So e.g. we could do 4500, lets say, and now it should in the x-direction, we rotated by 45 degrees. So let's just take a look and we can see, if we take a look at this, you can see it is now rotated around 45 degrees. And if we actually take a look at this, you can also see that the orientation now is not quite 45, but pretty much 45. There are sometimes rounding issues. So do keep that in mind that sometimes the rounding can be a little bit weird with especially these vectors because there's a lot of calculations that have to be done. So they sometimes round down or round up in a little bit of a weird way. We can also do something that's very interesting and that is maybe we want to move the part, right? So maybe we want to actually say, You know what? I actually want the position to change. So I want to take the actual position of my part and I just wanted to maybe move down by a couple of studies. So let's say make a new vector over here. We don't want move the x-axis. We do want to move it maybe 25 down on the z-axis. And maybe we want to do a plus five on the, actually not a plus five, just a 5-year on the z-axis. You can see this all works because if you do a vector, vector minus a vector, that all works out totally fine. So if we just play this, we're now going to see that the cube has moved where it has moved. Well, it is worth, it is right there. And if we take a look at this micro apart, it is now in 50, 75, 45. Now you're like, that's kinda weird. Yeah, that's kinda weird. How did this happen? Well, we subtracted this vector, right? So we take 50 minus zero, that's 50. Fair enough. We did 50 minus -25. Oh, well minus, minus, that's a plus, meaning there's a 75. And then here we subtracted five. So that's an interesting one where if we subtract something that we actually don't want any negative numbers in here. And then if we were to run this again, now you can see each will be lower down and there it is. So it's now a way lower down. And now our calculations to work totally fine. So that is the general idea of the vectors calculate, right? So it basically is always the first element minus or plus rate, e.g. that will work. So we would do if we keep the minus, that will be the first element. The new elements will be 50 minus zero. And then the second one would be 50 -25, and then the last one would be 50 minus five. That is the general idea of this. What happens if we were to say, You know what, let's times this. Is this going to work? Well, let's just do 22.2 over here. And let's just see what happens. So there's no errors. And if we take a look, it is now very, very far away. And if you take a look at this, you can see 150, 90. So exactly what we would expect here to happen. The same idea, right? Instead of doing a minus, we now do times two. And then we do this basically for all of them, right? So we do this, and then we do this. Now this is actually 45 and this was 25. And that is why we get 150.90 as the parts over here. Very interesting indeed. Now there's a couple of other things that are interesting and that is e.g. if we want to size something up, right? So we have the size over here. We can e.g. do a times equals and then we can size it up by 50 per cent extra. That's going to just multiply or size numbers by 1.5 here in this case. So if we look at this again, you can see this is now bigger now it doesn't really look like it that much. But if we go here and see the size is now 10.57 point 5.12. And if we're not running, the size is only 75.8. But those are some of the examples here of changing the position, the rotation, the size. This is really cool already, right? In summary, position or rotation is represented by a vector. And a vector is simply three numbers here, having an x and y and the z value. And you can change them with the normal operations, right? Multiplying, subtracting all of that work. So that is pretty cool and you do it like this. Well, that's it for this lecture right here. Hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 20. (Roblox) The Wait-Function: All right, let's continue the robotics basics here for the robust course. In this lecture, we're gonna be talking about the weight function. So the weight function is an incredibly important thing that you will encounter many a times throughout scripting and Roblox. And let's just create a new script over here, call it 06 dash waiting. And we'll just call this the weight function because it is about the weight function. Let's say I have a for-loop. I started at zero and I go to ten and I increment by one. Let's do this. And let's say I print out the number. So if we were to do this, it will print out the numbers right? Immediately. You can see zero all the way to ten in a matter of, I mean, literally almost all of them, even in the same tick, like the same milliseconds. That's how fast it was. But let's say No, no, no, no, no. I want this to print out every second. Well, we'll just use the weight function over here. I'll pass in one. So what it actually does is it yields the current thread until the specified amount of time is elapsed in seconds. Now it's very important is that this can have, let's say like negative consequences if there's a lot of scripts going on. So the weight function isn't a end-all, be-all that you should use it everywhere. There are other ways of sort of waiting for things to happen as well. So this isn't the be-all end-all. But in this case, if we were to run this 012 and you can see it keeps going. It keeps I can run around, it's all fine. And it keeps going exactly 1 s after another and our attend and now the weight is done. So that is pretty cool. This is cool for certain things like for counting things, stuff like that. That's really awesome. This is an example of where the weight function could be really useful. It's sometimes also it can be important if you're importing certain things and sometimes you're just like, I'll just wait for a little bit and then you can continue executing something. But like I said, the actual thing that it does is it basically yields the current thread. Now this is high level of computer speak basically for saying that it's sort of stops everything that it's doing in this particular sort of workload and then continues it after the seconds have elapsed. So there are things that when you use this, it could possibly break certain things in your game. So do be cautious and not use your weights everywhere. We're just like, oh, this doesn't work. Let's just put in a wait over here that that's usually not what you want to do. I just want to emphasize this one more time. What I'm going to comment out the print and that is pretty much all there is to the weight function. There really isn't anything to summarize. It just waits for a couple of seconds and you shouldn't use it everywhere in your scripts. There's gonna be some examples of where we're going to use it, which are going to be interesting. And then there are some examples where we could use it, but we might want to use something else. Well, that's gonna be it for this lecture right here, or we found this useful and you'll learn something new and I'll see you all in the next lecture. 21. (Roblox) Basic Part Movement: All right, welcome back to the robotics basics here for the Roblox course. And in this lecture we're gonna be looking at moving a part. So this is gonna be very interesting indeed. So for this in the server scripts service, once again, making a new script and we'll call this 07, and we'll call this movement. So this is going to basically take in some of the things that we've learned so far. Of course, to move apart, there are plenty of ways to do it. By the way, this is just one example that we can use with a current understanding that we have. So there are different ways that we would be better even to move parts, but it is possible to do it this way. So I just want to emphasize this is not the only way and it might not be the correct way for every certain thing that you wanna do. But we're just going to take a look at this. So basically, let's just get our cool part here. Organ, let's say local my part. And we'll say, this is game workspace dot my cool part. There you go. Then what we'll do is we'll make a for-loop. Once again, we're going to start this at one. We're going to then go to, let's say 15 and we will increase by one. And what we'll then do is inside of that for loop will say my part, that position is now going to be equal to my part that position. So the actual position that is at plus a new vector. So they're going to be vector three new. And then we'll just say, let's do IO over here, 0.0. So we're setting the current position to itself plus I. So we're starting with one. And then if we were to do this and we'd start, we just basically get position plus 15 because that's it. But what if we now wait a second in-between this, what would happen then? Well, let's just take a look. Let's stop this. And if we then find our part and we run towards it, you can see, oh, look at this. It is moving one step at a second because it's waiting 1 s and then increasing and then waiting 1 s in increasing and waiting 1 s and increasing all the way until it has reached its final destination, which would be plus 15 in the x-direction. And we can see this. So now its position is 220, so it should have been 205 before because of the, all of the recruits, the things that we've been doing before with the scripts. So that is the general idea. So you can use the wait function in this case to delay the setting of the position and this, and thus it makes it look like it's actually doing something. So you could e.g. also do, you could also do this, maybe 50 and then maybe you put it add a little bit less. So maybe like a quarter of a second. And if you were to look at this now, it will look much smoother. So if we look at this, you can see now it's not like smooth, but it's almost smooth movement, right? And we could do this even smoother. Now I have to increase this because of course it's going to move faster if I increase this or if I decrease the wait time. And if I were to look at it like that, now, you can see it's almost a smooth. So to summarize, while this is one possible way of doing it, we will actually see some other ways in future lectures as well. This is because there are some things that we need to cover before we actually do this. Because there's just a few more interesting things that are, well that needs to be added to your toolkit, so to speak. But for the time being, that was it for this lecture right here. Hope you found this useful and you've learned something new. I'll see you all in the next lecture. So, yeah. 22. (Roblox) The Touched Event: All right, welcome back to the Roblox basics here for the robust course. And in this lecture we're gonna be talking about the Touched event. Now we've seen a lot of things that we can change in the code and in the scripts. However, we have not really gotten to any part where we can actually sort of inputs something or we can make something happen while this is about to change, Let's create a new script over here in the server script service. We're going to call this 08 touched event. And this is going to be very interesting indeed. So the Touched event is an event, as the name suggests. And events are basically, well things that happen. These are, these are events that can trigger certain functions to then get executed. In the Touched event is basically called every time that a part touches another part. So let's just for the sake of argument, actually get rid of all my positioning changes here. Because we actually don't want those two. Well, we will don't want this to affect the R core part here anymore. So let's just play this and then our cool part should just stay where it is. Well, it's going to zoom off, but that's actually kinda funny. So that because of the movement here. So let's get rid of our movement as well. And now we should have a clean slate. So for the Touched event, first of all, we're going to get our part again. So my part is once again, game workspace. And then my cool part in this case, there you go. And then we're going to have a touched events. So we're gonna say my part dot and then we can say touched. And you can see this is a lightening bolt. So a lightning bolt, that is a, an event. So you can see this is fired when a part comes in contact with another part. Very cool. You can also take a look at all of the other lightening bolts. There's also a change, one right, fired immediately after a property of an object changed. Could be interesting that we want to see this destroying fires immediately before an instance is destroyed. Okay, touch ended is when you stop touching another part, and so on and so forth. Now we want to use the Touched event over here. And then we wanna do is we wanna do a colon and then connect. This is very interesting. So you can also do some other things. You can also do once this would then call something once. This one connects a function to an event, basically saying, Hey, is this particular event is called, then we want to actually call this function where there's also a weight which waits for something. And then here connect parallel is even more complicated, basically once and connect are the interesting things. So let's say we say one's right in here, inside of this particular function, the ones function, we can put another function, right? And then we say other part, and we're just going to make this function instead of this one. So you can see this is the function right here, and this is the closing parentheses of the once. And then we can just say print, and then we can say e.g. other part, right? So what happens here is that this other part is the part that it has touched my part. So if we were to just play this particular thing, what will happen? Base plate, you might be like what? Well, look at this. The micro part is touching the base plate, right? And if I were to jump on here, nothing would happen. Why is that? Well, because once means once, it happens one time. And then I said, however, if we were to connect this, right, if we were to say connect, what would happen now? Well, let's just play this and you will see It's going to spam base plate over here until it will no longer span base plate. Okay, interesting what happens if I now were to jump onto this? Well, let's just do it. And you can see humanoid root part, left foot, right foot. And also the questions, why does it stop? Well, the Touched event basically, you need to start touching and not like continuously touching. That is something a little bit different. But you can see that now depending on like a moving it, it gets like different parts of my body. Because if we go into the workspace count and Joe, I'm actually represented by a whole host of different like tiny parts. The left foot, the left hand, and so on and so forth. And not like my entire body so to speak. Okay, so that is very interesting. But now we can actually make stuff happen by touching a specific object. So we could e.g. in the micro part, Let's actually make this anchored so that it stays in the air. So now it's floating. So it's never going to be touching the ground. And then we can do we can do anything we want. We can print something out. We can let it start moving. We can shoot the player up into the sky. I mean, there's all sorts of things because this other part, right? We always have access to the thing that has touched our part. Therefore, we should have access to the player in some capacity or the character, right? So we can do something with it as well. In our purposes, the only thing that we're going to do is we're just going to make the object transparency less. So we're just going to say, we're going to make the transparency equal to one that So basically it's going to change 2.5 anyway, and then we'll change it to one once this actually touches something. So as soon as I jumped onto this object or I just brush it, it's going to basically disappear because the transparency is gonna be one. There, there you go. It's gone. Now it's of course not gone, right? It's still there, but it is invisible. So that is pretty cool that you can change certain properties now as, you know, as something is happening inside of the game. So now we're no longer just changing properties, are actually responding to things that happen inside of a game. And now just because it is a very fun thing to do, what we're gonna do is I'm now going to actually use what we have so far. I'm going to make a Boolean property is moving over here. And I'm going to ask, well, if moving is equal to false, then I actually want to do the following. I then wanted to, first of all put moving to true. And then I want to make a for-loop over here. I is equal to one and then we'll do ten and we'll do one, and then we'll do. And what we'll do here is we will wait for 1 s. And then I actually want to say my part that position. And then I want to change its position. So we're going to simply go with plus equals. Let's say plus equals and then just say vector three dot menu and then just one zeros, zeros. So once again, we're just going to move it into the X-direction by one n at the end. After this for loop has finished, then we want to say moving is equal to false because otherwise we will never be able to reset it basically. And then it's going to, it's not going to work basically the general idea, but this, alright, if we do this, now, when, once we touch the part, it's going to start moving into the x-direction, ten blocks for 10 s, and then it's going to stop and then we can actually move it again. So let's just see for the sake of argument here, right? So nothing should happen all this fine. I touched this after 1 s. You can see now it starts moving. Now I don't know what's going to happen once it arrives here on this spawn pad. I'm actually quite, Oh, what's going to happen? And it's going to stop. It is now stopped. And I can touch it again and it will continue to move about. As you can see. This is clear, isn't it? Because it's done again. And if I touch it again after a second, you can see it continuous. So this is really, really freaking cool. That is an awesome thing that is basically working here in this case is actually an example of how you can respond to something happening instead of the world. To summarize, an event is attached to a certain object. And if that object, if that event is fired, depending on what happens, then you can actually connect a function to it, and you can call that function every time that particular event is caught. In the case of the Touched event, e.g. this actually allows you to now respond to things that the player might do, insert the world and then do certain things with it. Well, that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 23. (Roblox) Creating Instances from Scripts: All right, let's continue the roadblocks basics here for the Roblox course. And in this lecture, we're gonna be taking a look at spawning new parts. So what is spawning new parts mean? Well, we're going to spawn hearts via scripts. So first of all, in the server script servers, we're gonna make a new script and we're going to call it 09 dash spawning. How about that? And we'll call this spawning objects. There you go. And what we'll do is we will just spawn a new object. So we'll just spawn new parts. And let's first of all do it in the script itself. And then we're gonna do it on touch in a little bit. So how would we spawn a new port? Well, let's just make a local and call it new part. And this is going to be while a new part, how do we spawn it? We're going to say instance, and you can see it already suggests this to us. We can autocomplete this by pressing the Tab key new. And then inside of here, we have to get the class name. So we have to put in the class name as a string as soon as I start typing in the quotation marks, you can see we can actually choose, well, a whole lot of different classes that exist over here. So we can add a new air controller, a new vector three value, new module script if we so choose. But in our case we want a new heart. In this case, we're just going to choose a new part. And what happens if I were to do this? Let's just play and see what happens. And what you will find is that, well, nothing really happens. Let's see. There's no, there's no new parts. So nothing really happened because this part, in this case, it's sort of created nowhere. So we can change the properties of this part. So we can say e.g. name is equal to a new part over here, right? So now we have given it a new name and we can even change the position, right? We can say while the position is now vector three new and let's say 0150 or something like that. And we also want to make it anchored, right? So we're going to just make this anchor. And now in theory, if all of this is fine, then we should see it roughly hovering above the spawn. And you can see nothing. And if we look in the workspace, you can also see my new part is not, is not part of this because we actually need to set the parents as well. This is extremely important. So parenting literally is just the idea if you look at the explorer over here, but the referencing script or to referencing and all my other scripts. The parent of this is the server script servers. So you just see that is the relationship. You can also see the parent right here. And if we go into the workspace, you can see the micro part, that parent is the workspace. And if you go into the base plate, if you go one further down, the texture here, that parent is base plate. Which base plates? Parent is the workspace. That is the general idea. This really should not be anything confusing. It just basically shows you the hierarchical structure of the explorer, and that is pretty much it. And now if we say new part, parent is equal to game dot workspace, all of a sudden we're setting it to the workspace. And now let's see if we can actually see our new part. And what you will find this all of a sudden, there it is, there's our new part. If we go into the workspace, we see a new port, exactly the same name that we've given it right here. And we've spawned it completely through a script. And usually this is always the order that you want to take. So basically, you want to create the new object, then you want to set some of the variables over here, right? So we're going to changing the properties. And then this is always important. We want to set the parent, right? And this is like a very, very important thing that we want to set the parent here. Otherwise, it will not be displayed at all. Now, what if we were to do something interesting, right? What if we were to just get the Touched event, right? So we're doing the same thing over here, but instead of moving, it will actually do something different. So what we'll do is we'll just copy this over and I will just comment this out because well, in this case, I actually don't want the thing to be connected to something else. We're gonna do this in the spawning. So we're just gonna spawn one object. And then we're going to say, well, you know what let's do, instead of moving will actually spawn something. So in the Touched event, when we were touching my cool part, I now want a new ports to be created. So we're just making a local Newport and we can do almost the same thing as this one, right? We can just say, Hey, in Newport, and let's just call this, let's call this another Newport. And let's put a 015. Let's phone and actually I'd like something like 20 and in this case will not make it anchored. And then let's actually put this up, push this back a little bit. 525, okay? And then we still need to parent it to the workspace. And we'll also add a little bit of a weight function over here, let's say half a second, because otherwise we'll just get inundated with new, new fricking parts to a little bit of a delay over here. But now what this should do is as long as I stand on the, on my cool part, right, it's going to Swan new parts in. So let's just see that does anything but I'm pretty sure that it will. Once again, we have our part that we had before. And if we were to jump on this, you can see, all of a sudden, they can see. And now you might ask yourself, Wait, why does it spawned so many? We specifically made it so that the weight function is in there. So if I were to just stand on this, but so you can see it's not spoiling anything. And if I were to move around and you can see that it is working. And the reason, of course, is that the Touched event, in this case, it's actually called for each part, right? So basically we're saying it doesn't even matter what the part is that is touching our micro part here. For each one of those, we're spawning a new part. And we've seen previously that the player is made up of tiny, tiny different parts. Therefore, this is going to get called an insane amount of time. So to quickly summarize, when we spawn a new part, in this case, we can do instance dot new and important in this case. Or we can also spawn almost anything else. We can spawn a whole host of different types of classes is what they're called. They're just basically saying, okay, what type of part or what type of object is this? In our case, we just want to port and there are other ones, right? The spawn location as its own class, things like that. So we could also spawn these things as well. In our case, we're just sticking to the parts at this point. We can then change the properties. And then very important that we set the parent of the new part that we've just spawn to game dot workspace, otherwise it will not display. And at the end here, we've seen that we can also connect this to the Touched event, which is really awesome. So now we're spawning things when we're actually interacting with the world. Pretty cool, but that's gonna be it for this lecture right here. I hope you found this useful and deodorant and the new one I'll see you all in the next lecture. So, yeah. 24. (Roblox) Click Detector: All right, let's continue with the Robo space X here, follow rule books course and in this lecture, we're gonna be talking about click detection. What could this be? Well, well, well let's create a new script in the server script service. And we'll call this ten and dash click detection. And this is going to be very interesting. So click detection, what does that mean? Well, you have probably played one or two games where you were able to click on something. And this is exactly what we're gonna do as well. So we will just create a new part in the workspace. First of all, let's create a new part over here, and let's take this and let's actually size this up a little bit, just so that we know that this is a different part. Let's actually make this 55.5. There you go. And then we'll also colored a little bit differently. Let's do this. Blue is kinda nice, but let's make it a little bit more blue. Yeah, there you go. Are also make this anchored so it keeps floating in the air like this and I'm actually okay with that. So we now have a floating port and we will rename this to clicker. And what this part needs is it actually needs a sub object. So we're going to click on this plus over here. And you can even see if frequently use click detector is exactly what we need to add to this. And you click detector just has a couple of things, namely the max activation distance. We'll talk about that in just a moment. But now we have a click detector on this. What we wanna do is we want to actually get that as a variable. So let's get the click detector, and this is a variable. And now we're going to go to game dot, workspace dot. And then we need to try to find the clicker. So we're going to use the clicker part. And then because the click detector here is a child object of the clicker, we can actually get the click detector as you can see. Awesome. So now we have the click detector right here, and this refers to this particular clip detector. And now we can just make a new function. So let's just make a new function on click. And we'll also put in the player because this is actually what we are going to get for the function, right? When you click something, we're actually going to get the actual player that clicks this. So first of all, let's just print out this player. Click Me, and then just print out player, just, that's all that we're going to do. And how do we connect this? Well, once again, the click detector in this case has certain events over here, right? So we have, and we have actually quite a few. So destroying, those are normal events, but then there's also the mouse-click event and the mouse hover, the mouse over leave and the right-click event. And the, I believe that those are the main ones. And that is pretty awesome. Actually. We're going to use the mouseClicked event once again using connect here. And then we can just put the onClick method inside of it without the parentheses though. So we just want to pass this in like this. And then when we click on this, we're actually going to execute this function. This is the same idea that we've seen in the Touched event before, where we connected a inline function here. We just created the function right here. But in this case, we have made the function before and then we're putting it in there. It's the same idea. Now if this is all the case, then let's just play and when we actually go over there. So the first thing that you will be able to see is that when I hover over this with my mouse, you can see it turns into a hand because, well, this is now clickable. If I were to left-click, you can see this player clicked camera. So now all of a sudden the server is like, yeah, the player clicks this particular clip detector. So that is really awesome because now all of a sudden we can interact with the game to a whole nother level. In this case, there's actually a second way that you could feasibly do it. And that is you can add a script to the clicker itself. So you can call this the clickers script, let's say, right. And then let's just take the same thing that we have in here. And let's just add this to the script over here. So this is now the click detector, but we can actually do something different. We can say script. This is taking our script inside of our hierarchy. And I'm going to say parent. And then we're going to say click detector because this script, right, we're gonna go to the parent which is the clicker, and then we're going to click the texture. This will also work. So if I were to just, Let's say, let's actually comment this out because that's a little bit better if we do this. There we go. So this is commented out and then we have the clicker script as a child of the clicker. And we can also do this. And let's just see, in theory this should still work. And if we go over here, you can see we're still getting this output and that can sometimes be better. So before, of course we put everything in the server script service. So it might just make sense to actually have the script below our clicker part. Because maybe if we were to duplicate this, and then we have a second one here. Now, this one also works without me having to do anything. Now there are two different scripts, and of course, now the issue comes in that you have to keep track of which script is which and all of that. But regardless of that though, it is kinda cool. You can also have this script below the actual part. That's not the main thing. Of course the main thing is the clicked detection itself, which is another way that you can interact with the world now and now we can use what you've learned so far, right? Moving things, sending the position and you can make something clickable and you can change positions, e.g. right. So just for the sake of argument, I have created something here that might be kind of interesting. So if I just play this and let's, and I'll show you. So if I go over here, right, we have this red cube at the top. And if I click this one, the red cube shifts over to above this. And if I click the left one, then it shifts back. So basically just a way of changing this particular cubes position. That is a pretty cool thing. Now I'm actually not going to show the code. The code will be available so you can download it and you can download the Excel file with this particular moving part display in it. What I would say is that, first of all, try to create this yourself. And if you can do it, that would be absolutely amazing. If you are stuck, you can always take a look at it. It is basically two clickers over here on the left clicker and the right clicker. And it is two scripts. However, the scripts are literally exactly the same. So there might be a way of condensing this into one script for the time being though, just trying to see if you can figure out how to create this. Because that would already be really cool way of solidifying some of the things that we've learned so far. So in summary, the click detector is a really useful tool that you can use for further interacting with the world and Roblox. And it can be used for anything really. You can just make a new function that is then called when the player clicks on a click detector. And that can do anything you want, right? But that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 25. (Roblox) Applying Forces: All right, let's continue with the Roblox basics here for the robotics course. And in this lecture, we're gonna be taking a look at force and everything to do with that basically. So what does force will force is basically adding a force to a particular part. And we'll just take a look at an example of this. So we're just add a new part over here, and we'll call this the forceful part for the sake of argument here. And what we wanna do for this part, well, we want to move this. First of all, we want to size this up though. Let's size this to 444 again. And then we can add a, well, we can add a lot of things as we have seen, but if we search for force, you can see a force-field. Now, we don't actually want to add a force field. We do want to either add a line force or a vector force. Now those are almost the same thing. There's a slight difference, but will first of all take a look at the vector force and then we'll look at the line force in a moment. The vector force in theory simply points to one vector and basically then shoots this part to a particular vector. However, we need an attachment. So you can see this is an attachment that is needed. And the force that is being applied as applied to, in this case, 1,000 to the x-direction. So it would all of a sudden shoot in this direction. So let's just set it down here. And if we were to just play this, you will be able to see that, well, nothing happens. So you can see the part over here, nothing happens. Let's change the color to yellow in this case. And we will be able to see that in theory, it should shoot in this direction. However, it does not because we don't have an attachment. So actually to this force report, we need to add an attachment. You can see we can just search for this and we can add attachment. And now the attachment is a part of this particular part. Now, if we were to move the attachment, you can see it. Alright, now that attachment is directly in the middle of this, which is usually what we actually want. So we can just say attachment. We can click on this, click on the attachment and you can see now this is attached. Now if we want to make sure that this is the right one, we can also rename this forceful part attachment. And if we were to look in the vector force, you can see forceful part attachment. Okay, let's play this and let's see what happens now. What you will see is that this still is not moving. So you might be like, that's kinda weird, right? Because we can move it, but it's not moving. Well, the issue is that there is friction between this part and the base plate because of course there are touching. And you can imagine this if you have a cube that's laying just like on a table to move it. That's not gonna be that bad. But if it's like a rubbery surface, that's gonna be a little bit harder because there's different amount of friction. So if we were to increase this force to, let's say something like 3,500 here in this case. I'm pretty sure that should be enough for it to start moving in the x-direction. And you will see, there it goes. And it frequent zooms off to the skies until, well, until it's gone basically. So that is pretty cool already. Let's try to do 2,500. Maybe that's going to make it a little bit slower. And maybe then we can actually see someone else as well. 2,500 is apparently not quite enough over here as you can see. So we need to do a little bit more, but that's fine. Let's do 3,000 and then that's hopefully not gonna be too fast. And then we can actually expand this. We can see forceful part. You can see the velocity actually is something because it's moving in this direction, right? It's actually having a velocity because a force is being applied if I were to increase this. So let's just say it was 50. Now the part is gone because it's flown off the floor of the sky. And if we're just restart this and go into the workspace quickly and change the force over here, let's say 5,000, right? All of a sudden where we got an insane amount of velocity now and it's way faster. Now this is a way of moving a part, right? With a force. That's really interesting already. To have this, There's a different type of force. We can also have, We saw this. There's a lion force. So the difference here is subtle. Vector force basically applies a force in a certain direction. In this case, the x-direction now does this relative to the attachment. You can also do with this relative to the world. The difference here is that if we were to rotate this, right, so right now we're using the x-direction, which is this structure right here. Which is fine. Because the extraction of the world is this way and the x-direction of the attachment is also this way. If we were to rotate the attachments. So I've now selected the attachment and I'm rotating it by 90 degrees, right? So let's just double-check over here. Modal rotate 90 degrees. I've just checked this. And if I were to rotate it by 90 degrees, all of a sudden the x of the attachment is in this direction. Now we're getting all sorts of confused because, well, the force, right, Let's just get rid of the line first for a moment. The vector force is using relative to attachment. So now we're going to zoom off in this direction. If you're like, wait what the heck is happening? Well, let's just take a look and you will see it's now not zooming in this direction, but in this direction. Because the force is being applied locally, because we have world coordinates. So the world in this direction is x, this direction is z, and the up direction is why that should all be more or less fine. But then you also have directions for your own parts, right? Because if you rotate apart, all of a sudden it's rotated. You see, this is now x, this is x, this is z, this is y. That's all fine. But if we were to rotate it around 90 degrees around the x-direction, right? All of a sudden, y is now different because we've changed the rotation. So if you change the rotation of something, you change its 3D local coordinate system ran a pretty crazy thing, but overall, hopefully somewhat understandable that there is a difference between a local coordinate system and the global coordinate system. And this was the vector force. Let's actually talk about the other force as well. That is the line force. Let's just disable the vector force here. And the line force needs to attachments as you can see. So what we can do is we can just make a new port. This is going to be the, this one right here, and we'll make this yellow, but like orange, that's gonna be okay. Let's scale this up just a little bit. Something like this. I'm actually fine with. And if we were to, let's say rotate this around a little bit and move this about two, something like this. What we could do is we can add this is going to be the line of force part. Just to demonstrate this, we want to add a, another attachment to this. Now this attachment once again, is in the middle of this. We can move the attachment and you should be able to see if we do this. Let's rename this as well. Line force attachment. We can now move this as well. And you can see it is a little dot over here that you will be C. You can also make this visible and then it's always gonna be visible even if we have not selected it sometimes can be useful. So if we were to just move this about like at the top over here, what we can now do is we can take the forceful part attachment and attach that to the other attachment, the labor force attachment make a line and then this particular object is going to move across that line. So it's going to basically pull the first attachment here. So if we go to the line force, right, it's going to pull the forceful attachment towards the line attachment. If we do a reaction force enabled, this is an important. And then magnitude once again, is just the idea of how fast it is going. So if we were to just run this, let's see if this does anything any will see, nothing happens but 1,000 was probably not high enough. Let's just do 4,500, something like that. Maybe that's gonna be enough in this case. And that is indeed enough. And you can see it's trying to get to this. However, it actually can't get up due to gravity in this case. So what we could do is we could also get this higher so we can make the line force even stronger. So we could do something like 7,500, maybe not 75 K, that's a little much 7,500, maybe something like that. And we can see if that does anything. And now it's like it actually knocked over the pinna, which is also kinda funny. But you can see basically it is drawing a line from the middle of this cube all the way to this one. So from the forceful attachment to the other one. So these are the two types of forces, in this case, vector force and align force, both used with attachments, which are also quite interesting because you can do a lot of things with attachment is actually, and we will see quite a few things with those in future lectures as well. So to summarize, overall, there are two types of forces, the vector force and the line force. The vector force simply applies a force in a certain vector direction for a particular attachment, the vector direction can be relative to the attachment itself. So it's going to change the direction depending on the rotation of the attachment itself. Or it can be relative to the world, which means that the objects, the objects orientation or rotation does not factor in which direction the force is being applied to. There also is a line force which actually uses two attachments. So it basically applies a force from one attachment towards the other. So draws a line from one attachment to the other and then applies a force on that line. And that's going to be it for this lecture right here. I hope you found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 26. (Roblox) Constraints: Alright, let's continue with the Roblox beginner section here for the Roblox course. And in this lecture, we're gonna be taking a look at constraints. Constraints are a very, very interesting thing that you can add in your workspace again, that is going to constrain the movement of your parts. Now, this is going to be a very surface level overview as an introduction here, this is, can be, I mean, this could have its own like two-hour lecture in theory. So we're just going to add a new part and we will just make this, let's say like a little bit of a darker orange, maybe a little bit of a darker orange. There you go. And we're going to just scale this up a little bit and we will add an attachment to this. So this is going to be the con, drained part and this is going to have a constraint. First of all, it's going to have an attachment. Actually. This is gonna be the con, streamed attachment just so that we know what this is. And then we can search so we can, so we can add a thing to it and we can just search for constraint. And you can see there are a bunch of constraints. As you can clearly see, balsa can constraint. There's a cylindrical consent hinge, no collision play in prismatic, rigid, like there's all sorts of things that you can have here, and those do different things. E.g. the rope constraint makes a rope between two attachments. So in our case, we're going to have the first attachment B, our own attachment. And then let's see. The second attachment is the attachment for our forceful part. And then you can see all of a sudden it makes a rope between them. So if I actually enable the visibility, you can see this is now a rope that is spun between this attachment and this attachment. And the rope is really cool. So you can have different thicknesses. So this would be a really thick, thick rope. So let's put it back to 0.1. You can change the color of it of course as well, right? So if you have a different color of rope that you want, that also works. And then there's some interesting things and that is the length over here, the restitution, as well as the winch enabled. If we enable the winch, then there's a few more attributes that we can use. But let's just see, Let's just make the length so you can see if I increase the length, ten is nothing but if I do two, Wendy, e.g. if I do 50, Let's go. Okay, So, so 20 is not quite enough, but 30, not quite 40. And then it starts to sort of slack over here because it's longer than it actually needs to be, right? So if I were to do 32, something like that, it's still taught. 35 is already sort of going down. So you can see that because the rope has a certain length. If I then move it, you can see it. It actually is. It's taking into account the length of the rope when it's displaying it. So that's really, really cool, right? And what will now happen? Let's say I make this particular part over here anchor. This means this guy does not move like whatever you freaking do. But what is going to happen is I'm going to re-enable my vector force over here. So the cube wants to zoom off in this direction. What do you think? What's going to happen? Let's just take a look and see what's going to happen. So we will find that the cube, while it's trying to move into this direction. But of course it can, because it is constrained by the rope constraint. This is really awesome. And you can do some interesting things with this. So that's an example of the rope constraint. Like there's so many constraints as you've clearly seen, right? One other interesting constraint is the spring constraint. This is this one right here, and this is a little finicky to use, but once you understand it is really cool. First of all, for this, I'm actually going to move the constraint attachment down a little bit just because it's just so that it's like on the same level as the other one. So this would be, where is it? This is minus four. So the word position is actually 1.5 in the y and the world position here is two. So let's just add, make this 12. There you go. And now it should be on the same level. And then we can actually attach this attachment zero is once again the constraint part and attachment one is the forceful port. You can see there's a spring now and we can change the appearance over here by adding some more coils. We can change the radius over here to craziness and the thickness to something really thick. Again, let's just make this always visible just so that we have this for the time being. And this is only appearances. So this doesn't change anything when it comes to the functionality. The functionality is then done over here with the spring. So the current length is 16. So let's just say that the three length, this is basically the length that you want. This, you can see actually it's the length at which the spring exerts no stiffness force. This means that it is not going to push this particular object anymore. And that's fine. If you say 16, then if we were to just run this, nothing will happen. And also it's zero stiffness, so nothing will happen anyway. But if we were to set the stiffness to 1,000, let's say let's put dampening up to like five, something like that. And let's just play this. Oh, but before we start, let's disable the vector force, just that we have this disabled. And then let's actually go in here and you will be able to see that when I am in, right. So right now nothing happens if I were to try to put this in here and look at this, right. All of a sudden it bounces back, right? So I can move this. Towards the spring. And it is always going to try to get the distance that is defined in the constraint over here. So you can see current distance is 17. I can make this smaller by basically pushing this right. And then it's going to extend again. Now the current length here doesn't change. It probably only changes on the server, which is actually kind of an interesting thing. So let's actually see if this is indeed the case. And you can see that you can do some pretty insane things over here. But yeah, it does change on the server. So that is good to know. But yeah, so this is one of those things that you can do, some really interesting things for this to work. Of course, the spring constraint needs a high enough stiffness and a certain three length basically, right? So if we were to decrease this free length, all of a sudden, it's going to pull this back because, well now the free length is 12 and it's going to try to get the current length to roughly be the free length. Not exactly, but as much as it can basically get. And because the spring in this case, once to actually keep an equilibrium, both of the like, it doesn't want to be too long and it also doesn't want to be too short. You can also enable limits. So this would be the max length, right? So you can, the maxlength is less than free length, doesn't really make any sense. So you can say something like 20 and minlength, you can say something like five and then you can't even move it closer to that. So if we were to now move this in over here just a little bit more. Let's see something like this that's going to be easier than if you tried to less than five, Let's actually do ten. Maybe that's gonna be a little bit easier and that's not even going to work. So you can see there, I actually see, I can't even like push this anymore because that's like the actual minimum length. If it's zero, then it can be as short as you want. So what I do highly recommend with the constraints, especially the spring constraint, because that can sometimes be, there's a lot of things that you can change over here. I highly recommend playing around with this a little bit, including some of the other constraints. So the row constraint is probably one of the easiest to work with. The spring constraint is a little more complicated, and some of the other ones are even more complicated. However, they do enable almost all sorts of physics-based things. So in theory with the spring constraint and some of the other ones, the hinges and the cylindrical it constraints. You can actually built like physics, simulated cars and stuff like that. That actually like our simulated with actual physics. It's insane that that is a thing that works, but it does work. But that's something for like advanced, advanced people, right? Like that's nothing for us at the moment, but it is pretty cool. So I can just highly recommend playing around with some of the constraints a little bit and just seeing what you come up with, that is basically always one of the best ideas to learn how this all works. To summarize, there are multiple constraints that you can add to your parts and then add two attachments. And it can constrain the parts on how they are able to move. There are many different types of constraints. We've seen the rope and the spring constraint as two examples over here. And once again, we'll mention, I highly suggest just playing around with some of them and then you hopefully we'll be able to find some cool uses for them as well. But that's gonna be it for this lecture right here. Hope you found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 27. (Roblox) Spawn Points: All right, let's continue with the roadblocks basics here follow robotics course and in this short lecture, we will talk about adding a new spawn locations. So of course, adding a new spawn location. That's nothing like that's insane, right? You can literally just do it by going to model spawn and then there's another spawn, or you could duplicate the already existing spawn. What happens if you have two of those in the same place? Well, let's just play. And we'll obviously see that I spawn right here. So I spawn next two are clicking Game over here. Let's just stop and let's play again. And let's just see where it's born now. Now I spawn also next to the clicking game. So that is pretty cool. And let's born again. And let's hope that the forces of randomness are on my side because now I've spawned not next to the clicking game, but actually next to the spring over here, which is pretty cool. So the idea is that if you have multiple spawns that are the same team, what's going to happen is that you're just going to be assigned one of them randomly. If you select one of the spawn locations and you go all the way down, you can see there is something called allowed change on touch and also the team color. So for this, you actually need teams. We're just going to take a look at this. So in our Explorer, we can actually add some teams. So we can add a team. We're just going to call this team red. And then we'll also add another team and that's gonna be team blue. Team blue. We're just going to make this a bluish color. And the other one, we're gonna make this a reddish color. Really ready, I like that's, that's pretty cool. And this is pretty much all that you need to do. We can make the auto assignable turn on or off. Let's just keep them on for both of them. And if we now go to the small location, right? And we go down, we can change the team color, really red and we can say, Allow team to change. And then we can go here and we can also say this, and this is going to be the blue one. I think it was this way, electric blue. I'm pretty sure we have our two teams. However, right now, the spoons or neutral, we want them to be not neutral. So when you spawn, you have certain teams that are associated with this. So let's just go in here. So right now I'm in team red because I spawn right here. If I go to the other spawn and I touched the other span, all of a sudden I'm Tim blue. Let's go and I can go back and go to team red again. And you can even see that you change the teams. Now this is not always what you want, right? Might be, maybe you actually don't want people to change their teams. So then you just say, Hey, you can't allow the team change to appear on us. So that does work. So you can just turn that off. And also what's important is that if we were to change this to, let's say, really blue now instead of electric blue, right? But if I have this turned on, the team color is going to be electric blue, but the team blue is actually going to have the team color really blue. What's going to happen now? Let's just see, I'm going to small team red. And if I go over here, this is now changing the team. You can see it changes me to neutral because it doesn't find the team color. This is very important. So this is an important part about this. So basically, if we go in here, the team color right on the spawn location, this actually has to be exactly the same team colors. So this would be electric blue. And then this also has to be electric blue. Those team colors are basically matched. This is also why you can have two teams with the same color. That is actually a very important part about this, but that is the general idea of adding teams and new spawn locations. Now, what you would want to do in the good thing to do is actually to create all of those teams and all of those four locations via a script. That is also a smart idea. We're not gonna do this for the time being. I just wanted to show you basically how to add another location and also how to take a look at team. So that's gonna be it for this lecture right here. Hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 28. (Roblox) Player vs Character: Let's continue with the Roblox basics here for the roadblocks course. And in this lecture we're gonna be talking about character versus player. So what is a player and what is a character? We have seen the players over here in the Explorer. And if we join, then we actually can see that there is something added and that is countable. So there's me, I'm added as a player, but if we go into the workspace, I'm also added in the workspace, which is pretty interesting. Let's take a look at this from the server's perspective. So in the server we can see we also have the player come through and we also have the modal kilometer. So they can see this is a model, while this over here is a player. So what is now the difference between the player over here and the model or the character, like what does each of those things. So the player actually contains what Player data, right? So this is going to be something that's unique to me in my user ID, I have a team, right? So this is specific to my player. While the character or the model is just the physical representation right here, right? So this is gonna be, this is the model or the character, and this has different colors. It has, it has a health set, it has a humanoid component. And the humanoid components as responsible, as you can see for some of the scaling, for some of the width, this even description. So you can see there's different accessories. So this is all of the visual things. This also includes scripts, as you can see, local scripts like animate. So this is basically all of the animations that you see when I move around over here. Those animations, right? The walking animation, the jumping animation, all of that, That's all done via the animation over here, this guy, which I can actually go into. So you can actually see, this is the animate script that's already in here. And you can see there's a lot of stuff in here. So as you can clearly tell, some of those scrubs can get pretty fricking crazy. So overall, when you really think about it, what's important is that the player, if we want to add any type of values, they're added with the player While anything else is added to the character. So you can see, if, you can see if I expand the player over here, there's a backpack over here, there's some starter gear. So if you have gear, right, you would save it in the player and it would be displayed in the character or the model. So if for whatever reason you wanted to change the way that our character looked like, you would need to actually reference the character and not the player. Now you can get the character via the player, right? Because if I click on control here, you can actually see that we have a character reference over here, and that is collegial, which is exactly this guy over here, right? So they are linked. You can get the character from the player. But that is the general idea. So to summarize, the character is everything that's visual. It basically has a reference to all of the models and all of the humanoid stuff, and it is available inside of the workspace. In theory, however, you would always go via the player. You'd always wait until the player has loaded or something like that, and then actually go via the player to the character, because the player has a reference to the character and the player itself is basically the actual client and has all sorts of inflammation, including some value store on it, which will actually see in the next lecture. Well, that's gonna be for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 29. (Roblox) Saving Variables on Player: Let's continue with the robots basics here for the robotics course. And in this lecture, we're gonna be taking a look at how you can save certain variables on your player. Now this at first might seem a little bit, and that's kind of not really useful, but it actually is very, very interesting indeed. So where can we add those values? We want to add those values to the starter pack. So what you can do is you can add values as you can see, if I search for values, you're going to add color values in values numbers. So there's a bunch of things that we can add over here. Let's just say we add an end value and let's just call this. I experienced just for the sake of argument right here, just so that we have something to work with. If we were to now start playing, right? And if we were to look into the player and calm Joel, and then into the backpack, you can see I've got some experience in my backpack. Now, of course, in this case, experiencing the backpack doesn't quite make a lot of sense conceptually, but just think about it as, okay, you will now have some experience added to your player. We're going to see this in the next lecture in a little bit of a nicer way. But just for the sake of argument, we're going to keep it like this for the time being. Now, right now, we can really do anything with the experience, like it doesn't change your mind. I guess we can change it here, but that doesn't do anything, right? But what we wanna do is, let's just say that we want to change the experience every time I change the position over here. Let's say when I jumped on the other block over here, right? So this would be the touch block, right? If I jump on this, instead of exploring 1 billion things, would actually want to do is I want to just print out the actual experience of this particular player. Okay, that sounds, that sounds very interesting. Now, in theory, you should already be able to do this on your own. But let's just go through this. Now first I'll actually make a new object over here and we'll cover this a little bit differently. So let's color this in a little bit of a different color, maybe a little bit more dark red. Yeah, that's good. Burgundy. Absolutely. This is burgundy. We'll keep this as a clicker with another script. This is actually going to be the experience clicker. And this is going to be the experience, experience clicker script because this is actually going to output what the actual experience of the players. So now we have the player here, right? When it clicks on this, we can actually do player dot and then we can do backpack and then dot experience. Is this going to work? Well, it's going to look for this. And as long as we've written everything here correctly, then this should work, right? So we should be able to say this player, right? And then we can actually do player that's going to output the player's name has XB, right? So this should be output, this player council has, and then whatever experience we have actually inside the backpack. Let's just see if that actually does anything, right? So let's go in here and let's see, where is it right here. So if I click on this, we should be able to see this count, this player count row has experienced XP. Okay, well, that is not quite workout as we wanted it to because our experience here, right, this is an int value. We actually need to do dot value and then we get the value because of course, when we just get experienced, we just get the name, right. So it defaults to the name and we actually want to get the value. So now in theory, if I do this again, if we go into here and we click on this, then we can see this player come through, has zero experience. That is a very, very good first step. Now let's see how we can increase the experience. For this. We want to change both the clicker left and the clicker right. There you go. And for this, once again, we get the player. So we can just change the experience, right? So we can basically just take this player backpack experience value. So this is the experience. And when this, when the player clicks, we just wanted to increase the value by one. That is literally all we wanna do. Okay, let's do it here, and let's do the same thing right here. And that should be pretty much what we need. So now the value of the experience is increased every time we click on the left and the right one. So let's just see if this actually does something. First of all, just to check somebody check hasZero experience that is absolutely correct. If we go to the player over here, look in the backpack experience. Now, I click on this one. You can see all of a sudden I have one experience. Now I have to 3456 and I can actually click on the same one and get multiple experience of course, but this is just an example in this case. If I now click on this, you can see I have 16 experience. Yeah, that's really cool, right? So if saved value on the player and it is now being stored. Now if I were to stop and sort again, we'll, of course, it's going to be reset, right? If I go back over here, welcome back. This is zero once again because we're not saving it anywhere. That is something that we're actually going to take a look at an intermediate steps because we actually have to save this onto the roadblocks Cloud, which is a little bit more complicated in also comes with some other things that you have to really look out for. But right now, you have saved a particular value on the player with an int value over here. And once again, I can show you there's different values that you can have. Boolean values, color values, and values numbers. You can even have object values, vector three values. So it's pretty cool what type of values you can store on the player. And you can basically enhance your game with that at statistics or attributes to the player. Now this is pretty cool already, but in the next lecture we'll actually see how you can add the leader sets. So this would be adding the stats on the leader board on the top right, right. If I join in here, we, we've seen the leaderboard because we have different teams and I can add certain values to that leaderboard as statistic and then change those as well. And then we can actually see them like more or less in game. So we don't have to basically go to like a random stone and click that to see how much experience we have. We're actually going to be able to see this in game. So once again, that is pretty freaking awesome. Our, that's gonna be it for this lecture right here. Hope you found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 30. (Roblox) Leaderboard with Leaderstats: All right, let's continue the Roblox basics here for the world works course. And in this lecture, we're gonna be taking a look at a leaderboards, or also called a leader stats. This is very interesting. So for this will actually delete the experience that we've put into the starter pack, because this time will actually generate all of our different values via a script. So in the server script servers, we're gonna make a new script and this is going to be 16 dash liter stats. And let's just add, this is either a leader board or leader stats. That's the general idea and this is actually very important that we do all of this correctly. So first of all, we'll have a local players and this is equal to game players. So this is going to take a look at this one right here. So the players over here, and it's going to get this. And what we can do is we can make a local function over here. And this function is going to be the leader board setup. And this will happen for every player and it's going to look like this. So we'll make a new folder. First of all, it's going to be called leader stats and then the folder itself. So this is a new folder and this is an instance dot nu, and this is a new folder. As you can see. This is just a new folder that's going to be created for each of our players will see how they're going to be added for each player in just a moment. But first of all, and this is extremely important. The name over here has to be exactly liter stats. Please pay attention to this. Has to be written exactly like this. Lowercase L, Liters stats. There's no space in-between, there's no dash, exactly like this. I've seen this so many times that people are like, Oh, I don't know where it doesn't work. It's because it has to be written exactly like this. Once that is the case, you can then set the leader stats dot parent equal to the player itself. So this is going to set the folders parent to the player, which is exactly what we want. And now we can add different values. So e.g. we can put back the experienced value. So we can do experienced equal instance dot nu, and this is now going to be an int value. And then we can see experienced dot name is then of course, experience. There you go. Then the experienced dot value is going to be zeros. So we're going to start with zero, which makes sense. Then very important here at the end. Experience that parent is then equal to liters stats. So we then want to parent each one of our variables under the leader stats. And in theory, we can just duplicate this or, or copy this and then change this to e.g. gold as well, right? So then just change all of this to gold. And let's say we start with something like ten gold. And now we have this. Now this is not cold yet anywhere, because where do we call this? Well, we're going to say players dot player added. This is a, an event over here as you can see, and this is called each time a player is added to the game. And we're going to connect this to the leaderboard setup. And now every time a new player joins our game, they're going to be given the leader stats folder with the int value experience and the value of gold with zero experience and ten volt. So that's really cool. Let's just play and see if this works. And I assure you that it will work. You can see now counting Joel has zero experience and ten gold. And if we open the player over here, we can actually see there's a leader sets folder. And instead of it you have the experience and the gold. And basically the leader board over here always looks for a leader stats folder and then displays this. Now of course what we can't do anymore is we can click this anymore because right now there's nothing in our backpack, so we actually can actually display this. So let's go back to here and let's get the experience clicker. And then let's also get a both of the clickers right here. So the left one and the right one, and we'll change this right here. We were changing the value of the experience in the backpack and now we actually change it in the leader sets. So how does that work? Well, there's a couple of ways that we can do this. If we don't want to check anything, we can literally just say liter stats that gold dot value equal to plus equal one, e.g. or experienced, I mean, whatever we want. Let's just do experience over here, and let's do experience over here as well. So we can do this. Now we're just gonna do this for the sake of argument, right? So let's just go in here and we should be able to find that if I do this, you can see that our experience over here increases. That's pretty cool. But what if, let's say this is prone to very easy arrows? Because in this case, I do a typo over here. And all of a sudden we're like, I do a type over here and all of a sudden I click on this and I get an error because hey, the experience is not a valid member. I'm like, What the **** is going on. I miss type this. So there is a little bit of validation here that you can do. And that is going to be something like this. So we can e.g. say, Hey, give me the leader stats for the player over here. So we're going to get the leader stands as a variable. This will throw no errors even if there aren't no liters. That's because, well, it doesn't matter. And then we can do a local and this is very interesting indeed. So what we can do is we can say experience stat, and this is crazy. We can say liter stats. And then put in liters stance colon, find first child, this is a function and this will search for experience. This might look absolutely insane. What we'll do then is we'll say, if experienced that Then, and then we can actually increase this. And we can use this by using the experience. That's what we can say, experienced that, that value is plus equal one. Why is this better than this? Well, first of all, this makes sure that both the leader sets exists, as well as finding the actual experience over here with fine first child, it is validated by using the if statement right here. And the general idea of this line rate is that this is true and then it returns whatever is in here, right? So basically we're saying, Hey, is this not null? That's generally the idea, right? So leader says it's not null. And then we find this, this child, which is then saved in the experience that experience, that value plus equals one is the same as this. So if we were to, just for the sake of argument, copy this to the red clicker as well, and we change this. You, we will see that this will all work. So we go in here and we're going to click here and you can see the experience still increases. This is much better scripting in this case, and it just makes sure that everything exists. Now what about the output? This still does not work well, let's go to the experience clicker over here. And then here, the same thing applies, right? We can basically just get this. And then instead of doing the plus equals, we can just say that we're going to print out the experienced that data value here in this case. And then we can actually do as well. We can do an else statement. So if the experience that does not exist for whatever reason, we can just say this player, player has no experience for the sake of argument, right? And then if we play this and we were to go in here, here we now have zero experience, right? And then we can get this experience up. Now we have six, so now we have six experience. That all works, right, so that's pretty cool already. Now, we can go even crazier just for the sake of arguments. So e.g. what we could do is we could say, well, if you click on this, we actually want to know whether or not you didn't have enough gold, right? Maybe it costs gold to move the thing. So what we can then say is we can then do this. And then we can also say, also find me the gold, right? And then we can say the following. If there's not experienced that this will now be gold star, right? So this is gold stat. Then we can say if gold stat, then we're going to check what the value is. If gold stat and gold-standard data value is more than one, because we're going to decrease it. Then we can continue with this and we can increase the experienced value. And we're going to decrease the gold standard value. So now we're going absolutely madness over here. Let's just copy this over to the other one as well, like I've already previously mentioned. Now, there is a better way of doing it. Instead of having two scripts like this, you can just have one script and do the same onClick function for both of them. For the time being, we're just going to keep it like this, That's going to be fine. But the general idea is that we're checking, okay, Do we also have a gold stat? And if we do, it's the value bigger than one or bigger or equal? Actually, this is what we want. Yes. And if this is the case, then we're checking for the experience that we're increasing the experience that in decreasing the gold. And we can also track over here instead of an, if, we can do an else over here. And we can then actually print out something like player doesn't have enough gold for the sake of argument. So if the player has zero gold or below about zero would be what they'd probably have. Then it's going to print out player doesn't have enough gold. So let's take a look at this. So let's play, and we will be able to see that if I go on here, right, I've zero experience at ten gold. I click this. Now I have one experience and nine gold and I can, I can click the same one. I'm at zero Gold, everything is still working fine. If I do this now, then all of a sudden, computer doesn't have enough gold. Now, the thing is still moved about. What we can do is we can change this to say, Well, you know what, It only is going to move if the goal is actually subtracted, right? So we're going to move the moving of this just to appear. And then all of a sudden, we can only move the part if we actually have gold. Well, that's very interesting, right? So we can move this about. This is all fine, right? There you go. And we move this one more time, and now I click here and all of a sudden, nope, doesn't work right? Like you clicked me, but you don't have enough gold. That's very interesting indeed, that this is some pretty cool functionality already. To summarize, we use the player added event for the players to create a leader board folder for each player that joins our game. And this folder is going to contain whatever amount of different variables we want. And they can represent any type of number or any type of value. Here, in our case, we added experience and gold, and we use this to validate. We need it in certain number of gold over here to move a part. And then we would get experienced as well. This is really awesome and it allows you to, allows you to do so many things. Now, things are really opening up and we're going to see like way more things that we can do. But that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 31. (Roblox) Collectable Parts: All right, let's continue the Roblox basics here, follow roadblocks course. And in this lecture, we're going to make parts that you can pick up. So how is this going to look? Well, first of all, let's just make a new part over here and then let's see. So first of all, we're going to make this our 333. That is, I think roundabout, the correct size that I want. I want to make them anchored and I just want to move them up just a tiny bit of the ground. So we're going to have something like this. Now we will actually color them a brighter yellow. So maybe this yellow, I think that that's a different one from him, right? No, this is new yellow and this is also new yellow. Let's then do the deep orange is also fine. So now we have this port and we're going to call this the gold queue, because this is going to be, well, a gold cube. This is going to have a new script attached to it, and this is going to be the gold pickup script. Now we're gonna do this all over here for the time being. And then I'll show you how you can make this way, way better. A gold pickup script for the time being, just to check this and what do we need? Well, we need to actually know what this particular gold Cubists, so we need a local gold cube and that's equal to script dot parent. And then we also need to have a local players and that is equal to game dot players. Once again, this is the same idea that we are getting those players. And now we have a local function called on part touched because we're using the Touched event over here in just a moment to pick up this particular gold item or this gold basically, there's several steps, of course, the first one would be, let's just connect this gold cubed dot touched colon connect. And then we're going to put in the part touched over here with no parentheses. So just like this, and now this function or this local function is going to be called every time that the Touched event is fired. But we want to only make sure that this is fired when the player touches this. So for this one we're gonna do is we're going to get a, the parent of the other part. So this is gonna be the other part of that parent. And then we'll get the humanoid of this humanoid, right? So this is going to be the parent. So the parent of the other part, colon, find first child, which is a and then humanoid. Humanoid. There you go. There's a long function call. Make sure to write this correctly. So find first-child which is a exactly written like this in the same casing as well. And if this exists, then we can do if humanoid then and now everything inside of here will only ever be executed. If the other part that touches this gold cube is going to be a player that has a humanoid attached to it. So the first thing we'll do is we'll do gold queue colon destroy, meaning that will destroy this gold cube. In just a moment. We will actually see that we can do this in a little bit of a different way. But for the time being, we'll just do this and then we can do the same thing that we've done in the clicker here already, right? So we're basically doing Leary exactly all of this, right? So we'll get the player stats, so we'll say local layer. First of all, we actually need to get the player. So for this, we need to do players colon, get player from character because we've talked about this from character. And we put in the hair and over here, we put in the parent over here, because let's think about this. We need the player right now from the players, but we only have access to the character via the parent over here. Because the character is the thing that actually touched right? This is the 3D representation of the model and actually touch the other part. And we need to get the player from this. This is the way to do it. Then we'll get the leader stats. So liters that's equal to player dot liter sets leader stats. There you go. And then once again, we'll get the gold stats, in this case gold star equal to liters stats. And this is exact same thing that we've seen here so far. We're just going to get the leader stats, colon, find first child. And the first trial that we want to find is gold in this case, if gold stats is true, gold stat is true. This one. There you go. Then what we wanna do is we then want to, well, not the name, but then there you go. We want to say gold star dot value is plus equals one. With this, we have now a gold pickup port, so we have one of those right here. So that's pretty cool. Let's just play this and see if I can actually pick this up. But I'm pretty sure that I should be able to do this. So if I walk towards it and touch it, the cube is going to disappear and I'm going to get one gold. And there you go, the cube has disappeared and I have gained 1 v. Now the cube is gone forever. And in theory, we could just duplicate it, Control D, and we can duplicate it and add some more cubes. But at some point you do get an issue, Let's say e.g. you know, actually, all of those cubes are actually going to get you to gold. Okay, well, let's change it. Well, wait a second. This has changed it in one of those, right? This has changed this particular one, but this one is not changed and this script isn't changed, and the others are also not changed. That's kind of a bit of a right, that's not too good. So what could we do to mitigate this? There's a couple of options that we have at our disposal to mitigate this. One of them would be to use a module script. Let's just say for the sake of argument, create a module script over here, and we'll call this, that is 17 dash. And this would be the gold pickup. Let's just call it like that. There you go. And then what we could do is we could just say, well, let's just take pretty much almost the entirety of this and let's just see what we're going to get as a function, right? So we're going to make a function over here. And we're going to call this module dot goal pickup. And we'll see what kind of parameters we're going to need. So we need the other part. So this is gonna be the first parameter. And then we also need the gold cube, that's gonna be the second parameter. And the last one is gonna be the players. That's going to be the third parameter. And now this should in theory work question mark. Well, I mean let's just see, right, so we're going to be able to do a two over here, and then we just need to require this so we can say local pickup, Let's say equals require. And then we want to say game dots, sort of a script service and then a bracket in quotation marks 17 and gold pickup. You can autocomplete with the Tab key. And now we should be able to call pickup dark gold pickup, passing the other part as the first parameter, pass in the gold cube as second one and then the players as the third one. And now, not only is this a little bit easier to read, write, and we can always go into this. You can actually, you can hold Control and click on this and then you're going to actually be brought into this function over here. So that's pretty cool. And now we have this inside of this particular part. So that's pretty awesome. Now we would still once again need to change all of them. But if we had this one was the one that we changed. Yes. So let's just for the sake of argument, delete the rest and if we now duplicate this, right? So now we have once again a couple of those, so we have four of those, but now they all call the gold pickup one. Well, now if I want to change the value, they're going to change floor or the night. If I now change the value in this module script, they're going to change for all of them. So if I were to play this right, and we were to go in here, we were to pick this one up. All of a sudden, I get six gold and I get six gold for this one and this one and this one as well. So now what happened is that the gold actually, because they all share the same function right here, they can all use this one. That's pretty cool because otherwise we would just be using the same function anyway. There's no real reason not to change it. Now this is very cool and straightforward already. However, let's just say for the sake of argument in the goal pickup, I'm now going to be like, you know what? Instead of having the gold stat like this, like the increase, I actually want to just do a increase variable over here. And I'm going to put this in here so that I can basically change, okay? A goal pickup can actually have different values. Now we're going to run into the issue of this be nil, right? And then if I play this for the time being, nothing's going to happen. However, as soon as I then pick one of those up, it's going to be like it's gonna be nil because it's not defined. And now we're right back to the same issue. If I change it here to a two, that's gonna be fine. But now I have a bunch of other ones where this is not the case. So obviously what you want to have at the end here is somehow all of your gold cubes having one script instead of each one of them having their own script right? Now the way that we can achieve this is let's just select all of them, right-click and we're going to group as a folder. This is going to move up to the top over here. I'm going to call this the gold pickups. There you go. And then I will also drop the script inside of the folder here as well. This is not strictly necessary, but it's just a little bit nicer. Now we're going to change this gold pickups a little bit. So right now we don't have one cube. Write the script here is actually now the parent. So this is going to be the pickup folder. Let's say, right, there you go. And what we're going to now do is we want to iterate through all of the children of this particular folder. So this is a for-loop now, so this is going to be four. And then what we can do is we can do an I and an pickup over here in, and this is going to be an i pairs. So what this does, you can actually see, it actually says returns an iterator function and the table for use for loop. So now you might be like what the **** is going on here. Don't worry, just give it a moment. So we're just going to use this for the following, and we're going to use this for the pickup folder, colon get children. So this is going to get all of the children, right? That's fine. And then we're gonna do something. What are we going to do here? First of all, we're going to say, if I is equal to one, then I want you to continue because that's going to be the gold pickup script. Okay, that's fair. Then I want you to do is pick up that touched colon connect. And then I want to use on-board touched. Okay, I wanna do this first and foremost. Now, it makes more sense, rather than doing it like this to literally just take this function over here and put it inside of here. Because now the issue becomes that you are going to, we're not going to name this now. So we're just going to have a function over here that's going to call this, because the accessing of the gold cube and the players is a little bit harder. So we're going to move the players up here, and we'll still need to pick up over here. And we also need the gold cube. However, we have the gold cube that has just now pickup. So this is an unfortunate doubling over here. So this is the pickup script. Let's call it like that. There you go. And then the pickup is actually the gold cube. And then we don't need either of this. And I went through this maybe a little bit quick. So let's just go through from the top to bottom again. So I have a pickup folder, right? This is going to be this photo that's now called for I accidentally call this forward. This is called pickups. Take us. There you go, Right? Because we're gonna do script dot parent, which is the script parent, okay? And then we have the players, this is still remains to be these players. And then we have the pickup script over here, which is the require for this. Now if we look at this, we can actually reduce the complexity of this even more by just saying, by just cutting this out. Because, why do we pass in the players over here? We could just say, Hey, you need to get the players. And then there you go. We've got the players. We can do this and it has access to the players. So you can see that like this, we're separating out certain things from certain scripts to number one make them a little bit easier to read. And number two, to reduce the things that we need to do in order to continue working on this particular game, right? Because let's imagine we're having. If we have like a giant field of, I don't know however many gold cubes over here, right? Having each one of them have their separate script and we need to change it for all of them. That's all ridiculous. That is crazy. This is why one gold script would be awesome if this all works. Now, in this case, all of them are going to have the same number over here. And even that we could change, Let's keep it at two right now. And let's just see what happens if we were to run this. So the first thing is going to see we don't have go pick up, go pickup. That is probably because we're actually looking at this is at 11 over here. So the issue is that right now, it actually does try to use it for the gold pickup script over here, which is actually kind of interesting. I would've expected the eye to say, Hey, this is the gold pick up, then don't do it. This moment when it's actually a zero. That will be interesting. But I don't think it is. No, it's still, it's still gonna be there. Okay? Alright, so the I equals one has not worked. So let's just do the following them. Just say if pick-up dot name is equal to gold pick up, then we want to continue. Now this in theory should actually jump over it, and indeed it does. So there's no more errors right here. And if we were to run into this 2222, Let's go. So now you can see, even though the actual pickups, right, the gold cubes themselves do not have their own scripts. They're being destroyed properly. And this is all done via one script. So this is absolutely freaking amazing. Right now we could go even one step further, right? This is now the last step that we're going to take. And that is, that's two over here, is still a little bit weird, right? So you could add another, a value to this particular gold cube. In theory, we could call this the gold value, right? So we could call this the gold value for the sake of argument. And we could call this to, let's say. And then we could say, hey, when the pickup is done, I actually wanna get the gold value, dot value. Now it's going to look for this value over here, and it's going to read out the value that is written inside of the gold cube, you get almost the same issue that you get with the other ones where you have to change it again. So you could also do something interesting. This is once again, this is just an example. This is just to get you to think about this. This isn't necessarily how you would absolutely do it, but what he could do is also in can say, You know what? Let's just get the x size and then make it a dependent, like how much gold you get, depending on the size of the actual block. So let's say this block is now two to two. And then we can just delete a bunch of the cubes. And let's just say we have a bunch of small cubes and a bunch of big cubes, and then we have a bunch of even smaller cubes. So that's gonna be cubes that are 111. So the, for the sake of argument here, right? So we're going to have like a bunch of very, very small cubes and a bunch of medium-sized cubes. And maybe there's like one giant cube as like 999, right? Just for the sake of argument. Now the question is, does this work? Well, I mean, we're just literally taking the x size of the pickup port as the value. Why wouldn't this work? Right? So let's go in here and we'll be able to see if I pick up one of those small ones. We get a one gold. There's two, there's three gold, right? 311, this is two. That's a two. And there's three again, three again, and this is a giant one and that's nine. So that is like once again, just to get you thinking about how you can stack all of the things that we've been talking about so far into one giant thing. Now I will admit this was a lot of things in here. So I do understand if there's still a little bit confusing, what I recommend you do is number one, you have the RB Excel file available for download, so you can download it. Take a look at the script. Number one, the gold pickup script, and number two, the module script. See how they work together. Trying to just change a few things in here. And maybe you can add some of your own pickups. Maybe as a little bit of an example that you can add yourself is maybe you can add, maybe like damaging things or healing things, right? Healing pickups and healing healing pickups and hurting pickups or something like that, just to get a sense of what is actually happening. But overall, this is absolutely amazing. So to summarize, we have a pickup that we've made with the Touched event. We started by having a script for each one of our cubes and then went so far as to now have one script over here that controls the cubes, that basically adds the Touched event to those cubes. And then one module script where all of the functionality is in. And this is one of the highlighted things where a module script is absolutely amazing for this, right? But that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 32. (Roblox) Adding Trails to the Player: All right, let's continue the robots basics here, follow rubrics course. And in this lecture we're going to take a look at how you can add a trail to your player. Before we add the trail, what is even a trail? So let's just add it to my cool part over here. We can just hit the plus n. We're going to search for trail and we're going to select this. And now it has a trail, right? So now we've added the trail, now we need to add a two attachments. So in theory to our cool part over here, we just need to add two attachments. So let's just do that attachment and then I just duplicated this with Control D. And we're just going to move this about two, let's say someone like this, that's gonna be okay. And then the other one, we're also going to move to the other side. There you go. And now I can use the first attachment and the second attachment. And now because it's attached to this, what we can now do is when we move this, we should see there you go, a trail appear exactly from that particular those two attachments. And you can change the trails to do all sorts of things, right? You can see in the trail over here, we have we can make it always face the camera. We even have light emissions. We can give it a texture. There's different modes that you can do. So static wrap, you can add a transparency to it and then also you can have some emissions over here. So lifetime maxlength, you can get the width. So there's a lot of things and you could also do really cool is you can add a color in the color here. You can add a color sequence. So e.g. you could just change the color red in the beginning to read. And then in the middle here it's like maybe blue and then you change it over here to a different green and then over here you change it to another color so you can get like rainbow colors or all sorts of crazy things. So you can see now it is roughly shaped like this. And if we were to now get this guy moving, so if we move this now, you can see, now it's changing over time as pretty cool already. You can see now it's changing the trail, It's changing its color linger up with some of the properties. So e.g. or down on the emission, you can add different things like have more lifetime, so then it's going to stay alive longer. You can have a minlength and max length and even adjust the width. So if we were to do like, I don't know, five year for lifetime, then it's just going to just stay there for way longer as you can see. Like it's just stays alive way longer until it decays. So that is pretty cool as well. While it looks cool right here, it doesn't really do anything for us. So let's add it to the player. The first thing we wanna do is actually in these servers storage, we want to add a trail and this is going to be the player trail. So this is going to be the trail that is added to the player. And for the sake of argument here, let's just change this to a, once again, a crazy colors over here. Why not? So let's just go for red and then a little bit later go to pink and then we go to blue. And then here we go to turquoise, ish, let's say, and then green, maybe a little bit later. And then we go to a more light green and then yellow. And then here at the end we go to an orange, and then at the very end we go to the darker red again. So now we have a cool rainbow color over here, which is pretty awesome. And we're going to use this and give it to the player. All of this is fine. Let's then take a look at this one here, right here. So we're going to make a max length of this, because otherwise it's going to, I mean, otherwise the length is infinite and we don't necessarily want that. And then we're going to attach this to the player. Well, actually we're going to attach it to the character, but because the character is of course the thing that is actually visible, right? That's the, that's the visible thing that we've gone through this before. But let's just add a script once again in the server stub service. And we'll call this 18 dash and we'll call this the player trail as well. There you go. And let's just zoom in right here. That's the player trail and we will make a local players. So this is gonna be our game, game dot players again. And then we want players dot player at it. So we want to check when the player has been added and connect this to a particular, connect this to a particular function here where we get the player and then inside of here, oh, this is players. Of course, there you go. Players added, there you go. Then instead of here, we want to do player dot, character added colon connect, and connect this to another function, This time getting the character. So we have two events over here, it inside of each other. This is totally fine and now we want to continue. So now we want to clone the trail. So we want to say game servers, storage, dot, dot player trail, this one, colon clone. So now we've cloned this trail. So we have a credit, a second object of this particular one. So we literally as if we were to do control C, control V, And now we've duplicated it. So that's the general idea of what clone does. Basically. We then want to say that the trail Don parent is now equal to the character. Then we want to wait for about half a second because this is necessary. What I from what I've found otherwise, the attachments and things like that don't quite work. And then we're gonna make new attachments. So we're going to make a new attachment. There's gonna be touched with zero and this equal to an instance dot new, of course, a new attachment. And we can immediately say that this is going to go under Character dot head. So this is going to go to the head of the character. And then we can say attachments zero dot name is going to be just so that we have this trail attachment zero. It's not necessary to change the name, but just to keep everything organized. And then we can make a second attachment as attachment one. And that is also Instance that new once again and then a new attachment. And this is two character that humanoid root part. There you go. And then we'll change the name of this as well. And this name is going to be trailed attachment one in this case. And now we still have to assign this. So we still have to say Trail dot attachment zero is equal to a tangent zero and trail dot attachment one is equal to attachment one. Let's just play and let's see what this is going to come up with. So there we are. And if I start moving, you can see all of a sudden we get a really, really awesome trail that follows us well with a certain length. And we can of course change this right? If we go to Workspace, count and jaw. And then down here, we should be able to find the player trail. And in theory, we could change this weight so we want to face the camera. So now it's always going to face the camera as you can see, which also looks pretty cool. So you can enable this on or off. There's light influences. So you can change it here and just like basically take a look at what this, what changes over here. So maybe we want to make this a little bit brighter or maybe woman, like you know what? No, it's actually going to be a zero brightness, then all of a sudden it's completely dark of course. So there's a bunch of things that you can do here and change it to suit your needs basically. And this can add a cape to your character array. This could be something that you want to add for your characters. Maybe you want to add this to your game so people can buy this, e.g. with roadblocks as an example here. But that is the general idea of a trail. So just for the sake of argument of additive to the left foot and the right foot of the character. And let's just see how that one looks. It's going to look a little crazy, but why not? You can see it still works. So you get a trail basically where the character steps. And that's actually also really cool. I can, I can imagine maybe this for a pet or something like that. Like a really rare pet that could have one of those trails that will look really, really awesome. But yeah, this is a trail and this is how you add it to specifically the character. But honestly, you can add it to mean anything really. So to summarize, a trail can be added with two different attachments. Now in our case, we're actually cloning it from the server storage and then adding it to the character via two attachments that we're also creating within a script in this case. And this is not only doable for a character, you could in theory also add this to Kaslow. Think that move different models. You can really do it anywhere where you have two attachments. Robot, that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 33. (Roblox) Three Types of GUIs: Alright, let's continue with the Roblox basics here for the robots course. And in this lecture we're going to take a brief overview look into Greece. Greece or GUIs are basically graphical user interfaces. And they allow the user to interact with a well a graphical user interface. And there are basically two different types. We can either create something in the standard GUI right here, or we can also create something in the world. Let's start in the standard GUI. And if we press the plus button over here, you can see it already suggests to us the screen GUI and that is exactly what we wanted to create. So we're going to create a screen GUI. And under this we can do another plus. And then you could see we can add certainly UI objects, e.g. a. Frame. And you will see that at the top left corner here. Now we get a white frame and we can even move this, so we can move this around. You can see we get some guiding lines. This is the horizontal middle, and then we can even get it into the exact center of the screen. We can then resize this so we can re-size it like this, right? So that is pretty cool. So we can basically just resize this as a lot of things. Even get some guiding lines where it's at, like how many pixels it is big and how many pixels it is from the top, e.g. and then inside of this, Let's just actually increase the size here a little bit more. And then what we can do, right when we center it again, there you go. We can actually add stuff to this frame as well. So we can e.g. add a text label and now we've added a label. We can send her this as well. We can maybe size this up a little bit and we can e.g. say, okay, we want to change the text that is displayed in the label. We can click on this label and then go down all the way to the texts over here, you can see not only can we change the style of the text, making it bold and maybe even cursive, right? We can do a lot of stuff. We can make a rich text label and we can change the text. So e.g. we can say this is an example of a text, right? And if I send this, there you go, bam, done. We can change the text size. I want those bigger. Let's make this a little bit bigger. 32, absolutely amazing. We can even make the scale, so then it scales automatically as you can see. So if I scale this particular element than its scales automatically, which is pretty cool. But let's just get this out of here. And you can change the texts as well. The texts color as well. So you can see under this text, there are very, there are a lot of properties that you can basically change in order to change this, let's actually also make this bold y-naught. And then we have a, well a text element right here. Pretty cool. And you can see there are some others. So text button, e.g. That's just a button with a text on it. You can also have a image button actually. So this will also work in Image button that will then have an image on it so you can click this button and certain things happen. We're actually only going to see a very tiny example here for the text buttons. So this is just going to be the close button. So we're just going to change this from button to close. And let's just size this up as well. Something like maybe, maybe 50 is going to be okay. And then we're going to also make this ball. There you go. And if I click this button right now, nothing would happen because we can just play this right? If I were to play, what's going to happen is that the GUI is going to pop up because the GYE always comes up. And while I can click this button, like nothing happens and the GY will persist. But of course, right, this is kind of annoying. So what you could do is let's just stop this. And if we wanted to actually disable this, what we can do is we can just add a local scripts to our text button over here, and then we can add something. So e.g. this is the example buttons script, right? This is just a button script. Now, this is a local script because the GUI only relevant for our client, right? Only for our particular player. We only have to do this on the local client. So let's get the button. The button itself is to script dot parent because of course, we're referencing this script and it's referencing now this button as the parent. And then we can get the actual panel as well. So there's going to be the panel and that is equal to the button, that parent, right? So this would be the frame itself as would be the frameless call it frame. And if we wanted to go one step further and actually go to the screen GUI, we can then say frame dot parent. So those are all three that we have. And when we actually wanted to do something, well, the button offers us an event. Of course, this would be the button dot activate, activated. Actually, there you go. So this is an event over here, lets the activated event right here. And we can do colon connect and then just make a new function over here. And we're getting nothing actually inside of it or we don't need to get anything. And then we can just say e.g. print button clicked over here just to have this. And then we can just also say screen. So there's gonna be our screen dot enabled is equal to false and this will basically disable the screen. That is pretty cool. Let's just see if this already works, but it should already work. So let's just go in and you can see, if I now click on this close, you can see buttonClicked and also the GUI has now been disabled because they started, we're right here at this one has basically been disabled now it's not been disabled right here in historically, because the GUI is of course also saved somewhere over here in the workspace or somewhere else, probably somewhere else, but it's replicated. And that is the general idea. That is why it is then disabled for our player. Pretty cool. So that will be one example of a GUI. Now, one important thing to note, if you want to, e.g. have an image, right? So if we want to add an image label here and just center it, you want to change this image to something else. The issue is going to be that you actually can't really change it to anything. So right now, our game is not published onto Roblox. This is deliberate, and this is why we actually can add a custom image here right now. As of this time, as soon as we publish our game. Then we can actually access the ability to also add images, and then we can actually also add an image here. So do keep this in mind. We're going to keep it like this for the time being. And we'll actually go to the screen GUI and enable, disable it. And then we're going to see the two other GUIs. So there's another type of GUI. Let's just say we want to add this to, let's say this particular block over here, the clicker. And what we can do is we could just do a plus over here and we can type in GUI, and you can see we can add a billboard GUI as well as a surface GUI. Let's first of all add a surface GUI and let's actually take a look at what this is. So I think there's only clicker. We can now add certain things to it as well. So you can see it is on this side. Now, let's change the face. This is going to be a front. We probably want the right or the left. Indeed, there you go. And now we have this on this particular site. So you can see that there is a label there. If I zoom out, then it's barely readable. If I zoom in a little bit and it's much more readable, and we can change this. So in the texts label over here, we can go in here and change some stuff as first of all, change the texts over here. So this is just, just example text. There you go. If we wanted to move this, we can do this. So by the position over here to the X and Y, now be aware that the scaling and the offset here is quite big. So e.g. if we do an offset of 50, we actually move across. If you do a scale, then you should do like 0.1 and stuff like that. Because otherwise it's gonna be like rocketing it out of the out of the service. So let's say e.g. 25, all of a sudden we have this centered on the screen over here. Let's also make this a little bit bigger, so it's a little bit easier to read. 32, maybe a little bit too big, maybe a 26. Yeah, there you go. And now we have this on here. So if we were to now play and actually go towards it, and you can see where is it? There it is. So it's hard to read and then at some point it becomes a little bit nicer to read. So this might not always be the correct thing that you wanna do. However, it is a surface GUI, so it is a GUI that you can put on a surface. But lastly, we have the third one. And if we add this, this is the billboard GUI. Now the billboard GUI is kind of interesting as it's kinda weird sometimes, but let's just add a frame onto it. And you can see right now it is in the middle of this object. We can change the position by using these stats offset over here. So let's just say I want to make this ten starts higher, and now it's over there. Now, when I zoom in and out, you can see that it changes its size because it basically always wants to retain its size well on this screen. So if we just make sure that all of this is set up, so in the frame, we want to use as the size one, comma zero, and then 10 here as well. Because we always wondered the, there you go. We always want the frame to fill up the GUI perfectly. The general idea is that if you use the size scale over here, and it's going to do 100% of it. If I want half of it, I could do 0.10, 0.05 would be 5%, 0.5 would be half of it. So now it's occupying half the billboard GUI as you can see, right? And then one of course would mean I'm occupying 100 per cent of it. If I then add a text label over here, right? So now that we have the texts label, let's change the text label itself. So let's just say it's going to be a little bit bigger. We 32, um, maybe, maybe we're gonna do 28 and that's going to be okay. And then the text is actually going to be clicked me. There you go, right? And if I were to just joining, now, let's just take a look at how this is going to look like. So if I change my camera here, so this is gonna be totally fine. This is actually a pretty nice billboard GUI. Now it is affected by the light over here. We can change this as well, but overall that's pretty cool. But now let's see what happens if I keep moving away and I keep moving away and I keep moving away. And you can see that this is a weird thing that happens, right? So at this point, it gets huge, idiots, pretty big. Now, we can still read it, which is actually pretty awesome, but it gets quite big. And maybe to be honest, like do we really need to know what the frog is happening over here for like 100 studies away. Not really. Maybe it should happen like appear anywhere out here, that would probably be enough. And we can change this by going to the billboard GUI again and going down to the max distance. Right now it's infinite, so it basically just shows anywhere where you are in the world. And maybe let's just say 50 here and let's see if this does something and it will definitely do something, but it was going to, well, there you go. It actually does exactly what we wanted to. So if we're far away from it, then it doesn't show. And then it also we don't have this weird sizing issue. And if we go in to certain radius, this being 50 states of it. So the camera has to be, so I can actually get this to sometimes show and sometimes not, but that shouldn't be totally fine. And then if we're in here, you can see it clearly and that's pretty cool. But the sizing here is actually the important thing. So having the scale and for the x and the y coordinate to be one. So basically to fill out the billboard GUI, and then usually the scaling is going to do exactly what you basically want it to. And that's the three GUIs, the screen GUI, the surface UI end the billboard GUI. Very interesting indeed, that actually concludes this lecture right here. I hope you found this useful and learned something new and I'll see you all in the next lecture. So, yeah. 34. (Roblox) API References: All right, let's continue with the robots basics here for the course. And in this lecture we're actually in the Roblox Engine API references instead of in Roblox Studio. Because this is basically where I show you a general overview of how you can use create robots.com. I will link this in the resources as well. And this is a very good resource for you to, well, as you can see, the logic into your experiences, roadblocks. So basically you have access to all of the different classes and data types and everything that might be in there that you ever want to take a look at. So e.g. what we have we seen before, we have seen before the plague detector, e.g. so let's click on this and you can see him. A click detector allows a script and a local scripts receive a pointer input from a 3D object through their mouse click event. Absolutely insane. It basically shows you a lot of stuff. It shows you an example over here and explains a lot of how this thing works, right? There are certain code samples over here that you can then understand. And there's even a summary where it gives you the properties of this particular class. It gives you the methods and the events that you can use. And this is absolutely amazing. So I don't wanna go into insane detail, but they're also hyperlinked. So e.g. if I'm like, oh, what is the script? Click on this. Bam, this is a script. This is absolutely amazing and I cannot recommend this enough. If you're ever unsure what something does or how does this work? What is this dual? We've just talked about the GUIs, e.g. right. So let's go up here to the billboard GUI e.g. BAM. But they are containers for GUI objects. You can see that their position is relative to an adornment. If there's no adore knee, then the parent is set as the underneath, things like that. There are so many interesting things that you can take a look at here. It is actually insane. I want to basically make this short and sweet if there's anything that you want to learn with some of the fundamentals that we've been so far talking about, right? If you've gone through the loo introduction, you understand Lewis somewhat. If you have gone through the roadblocks basics now and you're in standard. Most of the basics that we've gone through. You can almost go through any class over here and roughly understand what is going on. Now, of course, there might be some of them that are a little bit above, maybe some of the animation stuff and some other things might be a little bit too far gone at the moment, right? With a Cloud as well as storing something certain services, somethings might still be beyond you, but it's still really, really awesome that you have this available to you. And it's, it's so cool that you can just read through this and get more and more information. What you will also find on some of them is that they are, they might be deprecated. So I believe that okay, the angular velocity is actually not deprecated. Well, there are certain things that are deprecated, right? So we can actually see things here, e.g. the body position over here is deprecated and should not be used, but it always tells you what you should use instead, right? So this is an old one and that is really, really cool. So I cannot express enough how cool the engine API over here is. Like I said, I will link this. It has such a great resource. Please do take a look at it, right? But that concludes this lecture and also the roadblocks basics. In the next step, we'll actually make our first own game and that is going to be an ABI. So I will hope to see you there. Yeah. 35. (Roblox) Introduction and how this Section is build: All right, Welcome here to the first lecture in the army section. And I just want to quickly mention what kind of an OB we're going to build. So this is the finished RB that is going to be basically done. And if I spawn, I'm actually going to spawn at the end here, but that's gonna be totally fine. We can then basically see the Avi towards the end of it. So you can see we have some different shapes over here. We have moving things, so we have moving kill bricks that you can't touch. They move all in different things. This is done with the tween service right here. We have stairs that are going to disappear when you touch them. And then here we have just have some kill bricks and some other things as well. So this is really awesome and this is going to be a really, really cool RB. Now, I'm of course doing it the wrong way round, but that is totally fine. And there you go. So this is the general idea of the RV that we're going to create. Really cool things in here, highly recommended to watch. And every lecture is of course going to have an RB Excel file for you to download. So you can basically download the RB in any state that you might want to continue using it. I really hope you're gonna enjoy making the RV and see you in the next lecture. So, yeah. 36. (Roblox) Modelling the Obby: Alright, welcome back to the Roblox course. And in this lecture, we're going to be actually creating an ABI for this. As you can see, we're actually in Roblox Studio where we can create a new place. In this case, I actually want you to choose RB for this, because this actually allows us to basically copy at least like three or four different things that are already created for us. And it's just going to make life much easier for our OB. So let's choose RB and then you will see that the play starts and you can see this is our example. I'll be over here. So the general idea is this, that this is the template from Roblox itself. And you can see it has a star over here. We have some checkpoints already here as well as these purple ones and then the red glowing ones which are killed bricks. And yeah, that's pretty much what we have. And the first thing that we're gonna do is we're just going to save this as a file. I'm just going to call this RB1. And that's gonna be the file that is downloadable for you after this lecture. Well anyway, which are the parts that we want to save. Well, let's for the sake of argument, just play and see what this RB can do. We're obviously going to spawn here at the start and then we can move along here for the first part. And the one thing is that if we don't touch the middle part over here, we actually don't get this checkpoint is something we're going to fix it immediately. And then if we just continue along here, there you go. You can see these ones. They set the velocity over here so you have to be careful when you move onto them and jumped from them. There you go. And then the kill bricks, of course, they're going to kill you if you hit them. So you gotta be careful with that. And there you go. That's actually what I did over here, but no worries at all. Well, no worries at all. Let's just try this again. So something like this. There you go. Now we got it. Let's go. And then the last one is just a jumping pad over here. So you can see if you jump on this, then there you go. And now we've basically finished the RB. Now there's nothing happening, right? There's no great fanfare or anything like that. But it is a very good basic thing to start building upon. And that's why I wanted this. Basically, when you are back here, you should go to the select and what you can do is bid, pretty much just delete these parts over here and then we can size this up. So now we're going to basically design the OB. And we're going to have certain features not yet implemented because right now I just wanted to design a rough shape for the ABI, right? I just want to place some checkpoints. I want to place some kill bricks, I want to place some interesting obstacles, and then we will basically continue from there. So the first thing I recommend over here for the checkpoints is actually just sizing them up. So what you can do is you can select them, go to the scale tool and then hit Shift. And then it's going to scale them up basically in all directions simultaneously. And we want to scale them up to, let's actually take a look at where we're at. At this 0.92, 0.5, and how about 99 comma three, comma nine. I think that should be fine. And then we have a big one. Now you can also say, well maybe this is actually too big for us than we can also change this as well. Maybe we want this to be more flat, so then it's one. And there you go. I think a nine by nine is actually pretty good. Now, if the player hits the entire thing, then they actually will get this checkpoint registered, which is this one. It's just kinda weird that they did that, but that's okay. Then also, why not get two of those conveyors so we want one can vary. Let's go into the left and one conveyor that's going to the right. So we can just select one of them, hold Shift and select the other. And then we can just cut them out with by pressing Control X and Control V to paste them back in. Now, do note that they will be at the bottom here of the workspace, but we can fix that in just a moment. For the time being. I just want to sort of save them over here near the start. The same thing I'm going to do with a kill brick. I'm just going to copy this Control C and then Control V to paste it back in. And then I have the kill brick over here as well. And then we can use this later for all sorts of different things. And then the same thing I'm going to do for the trampoline. You can actually see that there is a surface G. And that surface Jew, I actually will disable itself inside of the game. I believe that's what the script is. Four, as you can see, surface GUI enabled equals false. That's why it has a script and that's why that actually doesn't show. So this is only for what you, while you're creating the actual game, which is pretty awesome actually. So let's just copy this as well. There you go. And let's just get this over here. And then we can almost just delete all the rest because all of the rest is sort of not really necessary for us at the moment, right? So let's just delete everything except for this. There you go. So now we have a store of an army and we have deleted almost anything. That's fine. And you can see in the workspace, now everything is just like randomly set up. So the checkpoints, this is checkpoint one. That's good. Let's actually change this as well. Let's make this a little bit more interesting. So we're going to start with, so maybe something like this. Maybe we want to scale this up a little bit. And we're going to move this about. And what I wanna do is I want to make a ramp over here. So we're just going to duplicate this Control D to duplicate. And then we can rotate this around. And let's make sure there you go. Yeah, that's that's something one of those thinking of someone like that you can do is you can maybe do something like this. So that's a little more tricky, right? You gotta jump from the side over here, turn this down a little bit more, that it's almost the same one. There you go. And then we got this. So now you've got to go up here and then actually. One more. Yeah, there you go. So you go here, jump up to here. And what's very important with the RV over here is also frequent testing because sometimes you're like, oh, this should be really easy to do. And then you figure out, wait a second, this is actually a really hard stage and that's not quite what you want to do. And then let's just make a ramp that goes down here. So let's just do this and this and something like this. And then there you go. Alright? So this is one of those things where you just have to try out a bunch of different things. And this is where the, this is what the modelling is very subjective. You can follow everything exactly how I'm doing. Or you can just watch this lecture and then actually copy the file from the finished one or just take a look at the finished one. And the idea is then also one big thing. You want to make this more colorful. If you keep these bricks with a stone gray over here, That's just really, really freaking boring, right? So you can just select them and you can say, Hey, this is supposed to be maybe like a blue over here, electric blue. Yes. And then this one may be should be like a cyan, right? And then this one should maybe be a pastel blue. And then all of a sudden you've got a blue state. And then there you go. We can play this. And you will see that you're immediately be able to play this. There we go. So we can just walk over here and we can jump over here, go over here, and then they go first-stage done. Now of course, it depends on what kind of an RB you want to make, right? If you want to make a hardcore army, that's really hard and of course you can do that. Usually people do prefer little bit of an easier RB and an easier time with it, but that's totally fine that it's up to you. You can design it however you would like. So let's then continue and let's actually create something over here. So we're going to create sort of a walkway. So we're just going to scale this up again and just a little bit longer and maybe just a little bit wider as well. So one in each direction. I think that's pretty good. And now here I want to use the kill brick. So how would I use them while I'm going to duplicate them, Control D, I'm going to make sure that I'm choosing the one that I've just created. I'm putting it under the killed bricks over here. The way that the workspace is organized here is basically via function, right? So we have all of the kill bricks together. We have all of the OB structure together, although the trampolines, although the conveyors, all of the checkpoints, you can also do it by stage. However, usually I think this is a better setup because some hobbies, they are like 500 pages long. And usually it's better this way because inside of the game, right, instead of the game view here, you can always click on something and it's going to highlight this in the Explorer anyway. So you don't really need to set it up in a way that shows each state individually. So what we're gonna do is we're going to make this so that you have to jump over the kill bricks over here. Let's just duplicate this again and then just go here. Nope, not down there, that, that would be kind of weird. And then another one, duplicate it. And then maybe something like this. There you go. And then one at the end over here as well. Let's just make this a little bit bigger so we can scale this up even more. And then we can just move this guy to round about here. I think that that should be pretty, yeah, that should be pretty fine. And here of course, also changing the color again because that's just gonna give you a nice contrast. Maybe move this guy about a little bit. There you go. So that's actually, I kinda like this right now. Of course, when you've done this stage, you want a, another checkpoint so you can duplicate the checkpoint, click on the checkpoint control D, and then we're just going to move this over here, makes sure that when it, that it's not too high up, right? Because if you duplicate something that it's always going to be like put higher up, which is kinda weird sometimes, but there you go. And that is pretty much that. Now the next thing that is usually seen and really liked, so I'm going to copy the part over here, that is stairs. So we're going to try to make stairs. Now. They are actually can be quite tricky to get 100% right. But they are pretty awesome regardless. So we're just going to make stairs. And then later we could e.g. if we wanted to make them disappear, right? So you can make it so that when you, when you walk up the stairs where they disappear behind you, that, that's always a cool effect and people do seem to like that. So how would we go about actually doing this? There's a couple of ways that you can do with this. What I basically want to do is first of all, I'm going to make a new, I'm actually going to right-click the part and I'm going to make a new folder. And I'm going to call this the stairs. I'm going to call the stairs 90 because we're going to make a 90-degree stairs. Basically, we're going to make stairs that go from this orientation to perfectly going to this orientation, right? So this basically means that we're going up and then we're going to end up in this direction. And I want to have this because then you can combine those stairs with another set of stairs and then you can have 180 stairs and then even a 270 stairs. And even if 360 stairs and just continue to go up in theory if you wanted to. So let's just duplicate this one. And what you wanna do is you want to rotate this. However, right now, per, per default, if we were to rotate this, we will rotate this by 48, 25 degrees. Yeah, 25.5 degrees, which is a little bit too much, right. So you can see if we were to move this around as like that's way too big of a gap for stairs, right? So you want to turn off the rotation over here and you want to make free rotation. So now you can rotate it by as little or as many degrees as you please basically. And this is where it all comes down to your personal preference, where you wanna go. So the same thing goes for the move right now we are going to turn off the move here so that we can move them in Lake. Miniscule amounts of studies. And you can always check this, right? You can always look at this from the front and be like, Okay, does this look like stairs, right? I really like somewhat, okay, here, this summit seems right. Okay? Maybe we want to expand this just a little bit more and then we can duplicate this one. And because it's always places on top, we actually, this is actually really cool. So we can rotate this a little bit more and move this again and do this again and rotate it a little bit more. And you can make the you can make the stairs as big or as small as you want. Now in our case, let's just take another look. Let's just take a look. For debugging purposes. What I highly recommend is you duplicate the start. This is kinda weird, but just bear with me for a moment. You take the original Stuart and you just disable it so you'd make enabled false, and then you go back to the other one and you just move it to whatever stage you want to test over here. Because otherwise you always have to play the entire RB. And that usually is just very weird, very strange. So we can see this would work. So the stairs, their work, that's fine. We don't need to we don't need to go down there and then they go so we can just continue with this and continue to rotate this. Like I said, you can make them as big or as small as you want. You can add as many stairs, right? You can say, Oh, you know what, I only want a little bit of rotation each time or maybe a little less, little bit more, something like that. Also just move them about so they don't always look the same or you can make very precise. So that is also something sometimes you want very precise. If you want a very precise, you can always go down to the transform over here and change the orientation manually by numbers instead of just sort of by eye, right? Because right now I'm just doing it sort of eyeballing it being like Yeah, that sounds about right. That's looks about right. So that is one thing that you can also always keep in mind. And we're approaching the rotation that we want very, very fast over here. So you can see we're just going to continue with this pretty much as I've said. And then another one. And then at the end here, we do definitely need to use the numbers there, but that's gonna be totally fine. Because at the end we can do this. So let's just do another one and another one over here. Sometimes the view is a little bit crazy. We would just want to go back a little bit. There you go, scale this and then rotate it again. May actually move this back just a little bit. So we can just rotate this back a little bit more so that it doesn't have a gap because I basically don't want any gaps over here. Maybe a little bit more of a rotation where we add at this point -98, That's actually pretty good. So we're almost at our -90 degrees, because as soon as we're at 90 degrees, then we know we have achieved where we want to go, but we're not quite there yet. So probably a couple more. Where are we at now? -92. Okay. I think that now this one is going to be the -90. So now we want to go into the transform to the orientation and we just want to do zero minus 90. And you can see now this is actually perfectly in this direction. So if we were to scale this, you can see this is now a exact 90 degree angle, which is pretty awesome. So we can just take this the, the checkpoint again, move this up, go over here, and now we have a checkpoint after the stairs. Now maybe you want to add another jump over here before you just go in there. That could also be the case, right? So just, just set this up. There you go. Let's scale this a little bit. Something like that could be pretty good, and then you should be fine. Those are stairs. Let's make sure to take this one out of it because that's not part of the stairs and now we have a 90 degree stairs. What I recommend here is also duplicating this, right? So just Control D and then you can just move it about. And what you can do is really awesome. Because now you could in theory, just duplicate this again. I take all of those stairs, just move them up and move them up. There you go. And you can rotate the entire stairs over here. But it's important that we actually rotate this by 90 degrees. Now, let's rotate this by 90 degrees. And all of a sudden look at this, right? I can just put them a year and put them here. And they almost fitting. It's just we just have to do this a little bit. There you go. Just a little bit higher, little bit high or not. Make sure it did not move individually. You want to move them together and then they go. And now we got a stairs. Now they look a little bit weird, but let's just see I, there you go. That's actually almost perfect. You won't even notice it. And now we have actually 180 steer, so 180 degrees stairs, so we can take all of those parts, put them into the other one does leave the empty folder and then we can call this, just rename this two stairs 180. Because now we've got to want AT stairs and we're going to once again save this over here in our beginning, where we basically have everything saved. That's gonna be fine. There you go. So that's, that's really awesome turnout. We can, in theory also have 180 stairs. Now they might be a little bit weird to get up on, but once again, the stairs or just a thing where you're just not going to try a bunch of things, right? So those stairs might be a little bit steep and a little bit weird, but in the end, they should work. So if I go in here, right, and I walk them across, there you go. I was able to walk up. So that's pretty awesome. Let's actually increase the, increase the gap here just a little bit. And let's actually put on the move one study again. There you go, maybe something like this and then something like this. So you gotta jump over here. So that's gonna be pretty interesting indeed. And then vanishing. We're actually going to see that in a later lecture. Because for the time being, we actually just wanted to create some other interesting things. The next thing, right? So this is pretty awesome, right? We got some, we got some of this, we've got some kill bricks over here. We've got some stairs that are going to disappear in the next lecture. And now I want to continue along here, right? So now I want to continue along and I want to just make some basic shapes. So let's just take a look at the size of this. The size of this is 616 is what I want. And I think that that's actually okay. I'm actually make this a little bit bigger. Make this 818. Yeah, that's that's perfect. That's great. This is exactly what I had in mind. And you can even change the position. So I personally always like to have the positions now with all of those comma values. So I'm going to change the position to 20. I'm going to change this to 14, and we're going to change this to 105. I think that that's gonna be okay. And then we're just going to change this position, 2105 as well. And that's going to make this a little bit crooked, but that's okay. Because then what you can do is you can just take sort of makes sure that this is, you can just hide it by just making this a little bit crooked as well and then just scaling it up and being like, Yeah, this is actually a crooked walkway and then no one should care about that. If people do care, usually it's not that big of a deal. And you can always change it later as well. Because the modelling of this, as you can see, right? So, so far, I've just been modeling for a good 20 min or so and we already got a few stages in there. And the best thing about it is that if you have some cedars done, right? So this state right here, you can copy this exact stage and reuse it later down the line as well in a little bit of a different way. So that's always a thing that you also have to keep in mind that you can always reuse stages. Now, I actually don't want this to be rotated. I actually think that the zero minus zero is actually okay. We're just gonna do it like this. We're just going to make this bigger. Yeah. Something like this. Maybe maybe just a big a big platform. There you go. Okay, that's good. And now we can proceed to this one. So what does this one going to do? Well, this one is going to, this one is going to have killed bricks in-between. Select a kill brick. Okay, I don't know what happened, but for whatever reason those ports are under the kill brick. I don't know how that happened, but okay. We want to of course, make them under the OB structure. There you go. And now we can duplicate this Kubrick. I don't know how that one happened. If that would've happened, I don't know, but if something like this happens, you should find this out pretty fast. And then you can always correct that our individual platforms and in-between those platforms, I want to have the kill brick over here. And I want to have them be this way or I don't want them to extend this way. I want them to in a bit move around like this. Now we're not going to implement the movement in this lecture again, right now we're just modeling everything. Because the most important part about this and this is also, I mean, I've talked about this before, is that you want to just make sure that when you are creating something like this, especially you're just taking it one step at a time. You don't necessarily need to do everything all at once. Just model the RB first and then all of the functionality, the movement for certain parts, the disappearing of other part, how you display something, right and in the leaderboard and all of that, you can always do that later down the line. So how about this? I think that that is pretty good. And I think that we can then just copy the thing over here and we're just going to basically replace this one. So we're just going to replace this one with our trusty old checkpoint, where indeed also in the future we have to change things in the checkpoint. But once again, none of that matters right now, for the time being, we just want to model something and that's actually pretty good already. So I'm pretty happy with this. We have some movement over here, we have some other movement over here. And then the last thing we're just going to do, first of all, we're going to re-color this because to green stages actually that's three green stages at this point. Well, while that cannot stand, Let's actually re-color all of this as well. Let's just go in here and make this, how about we make this a not a red, maybe a sort of like a light pink persimmon. Alright. Okay, That's the color persimmon shore. And then we're just going to make sure to take all of these ones and we're going to know, I don't want to move them. Are you crazy? I just wanted to select them and then we want to re-color those, maybe a yellow, that's gonna be okay. The yellow and the red actually work very well together. And then we have to check point over here and then what could come next. So how about we are just going to copy one of these ones. And what I wanna do is I wanted to actually have a little bit even more interesting shape over here. So what we're gonna do is we're gonna take this part and I'm going to go down and we're going to make this not collectable. Now the reason for this is because then if I duplicate it, I can actually move the same part inside of itself. And I can then rotate this around. And you can see if I actually make this 45 degrees on the rotation, I can now make a little bit of a star. So that looks much more interesting than just having a normal platform over here. But wait a second. Now, those actually, they, they don't really work because now they can collide. So the player is just going to fall through them. This is true. However, if I now take both of those parts, if I just select both of them parts and go to model like this, I can do union. And if I do union, this has created a new type of part which is a union and they are now together. So basically all of the So both parts are fused together. They're not welded, they're actually one part now. And if I now I can just enable the candlelight again. And now the player can collide with this new part. So this is a really cool thing that you can do. You can actually go further with this, which is pretty interesting. So you can go do this e.g. we're going to just do this with another part. We can do a candlelight false. We're going to make a new port. And then let's say e.g. I. Take this and I'll just make this a little bit smaller, right? Like something like this and this son have a smaller part on top of the bigger part. And what I usually do is I usually suggest to make this a little bit bigger so that it's like, actually like you can see that it goes through the entire array. And if we make this a negative part, right? And then we select both of them and we union this layer, this, all of a sudden, we have a big hole in this part and this is totally fine, right? So you can go in here and we can do a can collide and the whole the player is going to fall through. So this is actually, this makes this so much more interesting to look at, right? So let's get our stored over here and actually move this up above, up above. Because I actually want, don't want to play all of the rest of the level right now. I just want you to show you the, the union and the parts. There we go. So let's just go in here and let's see. So there we are. And if I go on here, you can see we're doing this and here I can fall through this, no worries at all, which is really cool, right? So with the union and then negate, you can create such cool parts that are completely different from just the normal lake rectangles basically. And of course, you can also add cylinders, corner wedges, wedges and sphere and spheres here. You can also add those and just with them and a little bit of a union and negation, you can actually create some pretty interesting things. So let's just call this one just so that we now can keep track of this. This is just the square with hole, right? And this is the star. How about that? Right? So now we've got a store and a square over here. So that's pretty cool. Let's go to another type in here. So let's just get a cylinder. And we're just going to take the cylinder and we're just going to make sure that it is inside of the structure of the ego. Now we actually wanted to rotate this around by 90 degrees in this direction. And we can scale this up a little bit. So you can see now we got to a circle or a cylinder over here. And now we can actually get a circle shape size as well. So let's see, is this the same size? It is. Now we also have a circle. That's pretty cool. There we go. We can now make this the yellow as well. This was this yellow, red, bright yellow? Yes, it is. That's the goal. You've got to store. We got a square with fall and we got a, let's call it a circle, even though it's a cylinder, but then everyone knows what it is, right? So this is actually like this is really awesome. You can see with this you can build some more interesting shapes that are just coming to, that just make the game look way more interesting. Now e.g. right in our shapes over here, what we can do is we just sort of move them around. Maybe take the, take the store here, maybe rotate it a little bit. So of course, if we rotated by 45 degrees, it's not quite going to work, but let's rotate it by 22.5 degrees and then it's actually going to look a little bit different. There you go. So now that's going to look a little bit different. We can also take this one. We can also rotate the square around because why not write? So let's also going to look interesting. There you go. And by the way, you can also scale this and it's going to do a few weird things, but you can scale it. So that is also pretty cool about the scaling does usually only work in all directions at once instead of just one. So there you go. Now we got that one. And then we can get another circle. Routing the circle around the y-axis is not going to do anything for us, but that's gonna be okay. And then there you go. So now we got some crazy shapes over here and we can add a new checkpoint at the very end, just making sure that we have enough space. There you go. And then that is that. So now we got the checkpoint here, and now we got our crazy shapes. Just like this. I think this is enough demonstration to show you. Okay? You can basically add individual parts, right? And maybe you want to use these shapes in a later level as well, which you can, of course, right then you can use them and maybe you actually want to rotate them so you have to walk up on them. And all of that. You can do many, many things with a custom object in this case. Now, modelling here, I actually think that we're pretty much fine with this. So let's just delete the start and the other star makes sure to re-enable this. Otherwise we might have some issues. Let's save this and let's go into the game. And let's just see if we can actually run this. This is absolutely fine. We got this on lockdown, that's great. And now let's see if I can jump over these and I can, That's amazing. Let's walk up the stairs. Oh, we got a little bit of a hiccup over here. So that's an interesting one. So yeah, that's the method that actually does work. But this stage right, right now they don't move, so you just have to jump over here. However, it is actually harder than you might expect to get the timing exactly right. And then now here we got those ones. Now you can see the cylinders are actually gone. This is a little bit of an issue, but, and we can actually make that jump. But the reason the cylinders are gone, of course, is if we actually go in here because they are not anchored. So we can see right now they are not anchored. So make sure they are anchored. Every time you add a new part here, you want to make sure that they are anchored and then there you go. And this is pretty much at the base RB that we're going to keep for the time being. What we're going to do. We didn't work with the conveyors because it uses the velocity over here, but it uses the velocity property. And actually that doesn't quite exist anymore. It's still works. But I personally would argue that it's probably better not to use that unnecessarily, but that is fine. You can use it. But just be aware that that might not work quite the way that you would expect it to. Regardless of that though, I'm actually pretty happy with this in the coming lectures, the specific things that we're going to do is we're going to make these things rotate around. As I've already discussed. We're going to make them rotate around. And we're going to maybe rotate some of these shapes over here as well. I'm not sure about that quite yet, but something like that. We're also going to make sure that the checkpoints actually display on what stage you are at. And we're also going to make it so that you have a leader board with the different stages inside of it. And that's pretty much what we're going to do for the entire audio in this case, it's gonna be pretty interesting indeed. So the finished file of the creation here is of course, available to you for download. Otherwise, I hope you found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 37. (Roblox) Adding Checkpoints to the Obby: All right, let's continue here with the RB for the Roblox course. And in this lecture, we're going to basically change the way that the checkpoints work. And for this, what we actually need to do is we need to take a look at the current checkpoint script. So we have a script in here, and you're going to see this and you're going to say, Oh my Lord, what is this craziness? Don't worry at all. For the first part of this, just slow down a little bit. This is a lot at once. You have to take it line by line. I'm just telling you zoom in and what you can do is you can even make it so that you can literally just see line-by-line just for you to understand it. Because overall, this is actually not as crazy as you think. You're gonna be overwhelmed for the first moment that you see this, but then you're gonna be like, Okay, wait a second. You know, all of this, you know, when if statement, you know, and you know what that means. Okay? If hit, this is a Touched event, okay? So you connecting this function to it, okay? We've seen this already. Then we're saying if something has hit this and there is a parent of it, and the parent has a humanoid basically saying, if the player has hit this particular spawn, right? If the, if the player has hit the checkpoint part, then we're inside of this, okay, then we're doing all of this. Okay, that's good. Next part, we're getting the player that we've seen this before as well, then we're getting checkpoint data. Now, if this checkpoint data does not exist, then we're actually creating a new checkpoint data as you can see. So if checkpoint data, if not checkpoint data means if it doesn't exist, then we're just creating a new instance of it and we're setting it into these servers storage. Well then also naming it checkpoints data and that is it in the local checkpoint, then it is going to be, we're basically checking if the checkpoint data already has a checkpoint saved. And if that's not the case, we once again are just creating a new object value with this player. And then we're connecting a new function over here that basically waits until we respond and then we'll respond at the location of the new checkpoint. And that is pretty much all that we're doing. Now. Once again, some parts might be confusing, especially the C frame over here. Basically, C frame is just the way that you can set the position of a part. That's pretty much all that you need to know for the time being. And the first thing I wanna do here is I want to make this a model script because this is the same script in each checkpoint, we just need to change a little bit like one thing basically, and then that's it. So why would we then actually not have this? So what we wanna do is we want to go to our trusty old server script service and we're gonna make a new model script. I'm going to call this the checkpoint script. I like that, that's good. And what we'll do is we'll take the entire thing right here, all of this. And we're just going to put this right here. So we're going to say this is the module dot add player, Check Point, sure, equal to function. And we need the hit and we actually also need to spawn location. I will show this in a moment, and then there you go. Now this is the function. And we actually also just to make sure that everything is fine, we actually want to copy the if statement here as well, because I found that this works a little bit better. If we do it like this, then we can just call this. We can just take this module and we can require it in the script over here, and then that's it. That's all we need to do. So local checkpoint, checkpoint module is equal to require and then we'll just requiring game dot server script service dot checkpoint script. There you go. And then we can call a function right in here, right, app layer protect point hit and the location is just spawn. And then that's it. That's all that we need to do in this case to make this work. And we can see that it's still works if I just go in here and I just changed all of them. Right. So we're just so the first one is the one that change and all the other ones we're just going to delete. We're just going to select them all. If you select something hold control, then you can just select multiple ones. And then we're just going to duplicate this a couple of times and move all of the new scripts to the other checkpoints. And what we will find is once we start the game and we actually go to the next checkpoint, right? The, the thing should really should only happen when we cut touch it, but you can see we actually get an unassigned property. So this is actually a very interesting thing. Now the reason why we get this, as you can see, that we're getting this in the value over here right now. The reason for this, this is the spawn right here. Because of course we need to use the spoon location. So let's just stop this and other awesome thing this before, if we had a table like that, we will have to change it in each of our scripts. But now I can just go into our module script can say, well instead of spoon, we actually want the small location over here. Save it, play. And now it's going to work for all of our different checkpoints. That's what the module scripts are, so incredibly powerful. So let's just take a look and there we go, no more issues. And if I were to jump down over here, I'm going to respond at that particular location. And you can see, there you go. I respond here. And the same thing will go if I go on here, and I go right here and I once again just jump off. Then you will be able to see are then spawn right there. So all the checkpoints are now working totally fine, as you can see, which is really, really awesome. And well, that's pretty much all that we need to do to make them more robust. And now the great thing is also if we were to add a new checkpoint, because it now has the same checkpoint script, it would just sort of just continue easily. So once we've set this up, now, every new checkpoint that we add will use the module script. And if we want to change something in here, e.g. in the next lecture, then what's going to happen is that this is just going to work. And that is actually with everything that we've learned so far. The Touched event, we've seen this before, requiring a module script with seen this before in other modules script itself, the function here, it's a little more complicated, I will give you that. But overall, when you really take it line by line, it should be understandable. And with that, that's actually it for this lecture right here. Hope you found this useful and you learned something new. I'll see you in the next lecture. So, yeah. 38. (Roblox) Adding a Leaderboard with Leaderstats: Alright, let's continue with the ABA here for the Roblox course. And in this lecture, we're going to create not only a leaderboard, but also the numbering system for our checkpoints. So this is going to be very interesting in deed. So the first part of this is going to be, well, basically adding numbers to our checkpoints. Now I'm going to do this in a little bit of a cheeky way. I'm actually going to make a new script instead of our checkpoints right here. And we're going to just going to call this. First of all, there's gonna be a script right. There you go. And we're going to actually rename this to the checkpoint numbering. Because funnily enough, if we go in here, if we make sure that our checkpoints are set up in the correct order, right? So you can see this checkpoint 123, this is four and this is five. If they are set in the correct order here, then we can just number them from the top to bottom and we should be totally fine. So this is actually what I'm going to do with this script. So that is what this script basically requires. If they are in a random order, then that's not going to work. But usually if you duplicate them than they should be in a set order and that is fine. So for this, what we wanna do is we want to first of all find the folder. So this is of course script that parent should be fairly self-explanatory. We then have a count, right? This is gonna be one. We're going to start with one, and then we use a for loop. And the for loop we're going to use is we're going to get the children of this particular folder weaning, we're going to get all of those. So what we're gonna do is we're going to say checkpoint. So i and Check Point. And the reason why I have two things is because if I do folder colon, get children, we're gonna get all of the instances, which is this check point. But the first thing is actually going to be an int value, or in this case just the index. So get children. And then what we wanna do is we wanna do this. We want to first of all, call this number and this is equal to a new instance dot new. And we're going to call this int value. I'm going to say number dot name is equal to checkpoint, checkpoint number, I'm going to say number dot value is equal to count because we want to set this to one in the beginning, they want to say number dot parent is equal to the checkpoint. And then the end here, we want to say count plus equals one. Because of course, with each new checkpoint, we want to increase the count and that's pretty much all that we need to do, right? So let's actually play this and take a look at the checkpoints here. Now, what is important to note if we actually open the checkpoints, right? You can see that first of all, we have all the checkpoints. Let's actually just switch to the server so we can move around. This checkpoint right here. You can see is now the value one, this checkpoint as the is actually changed the position here, but that's not an issue because it still has value too. Sometimes the positions you change, but they shouldn't change. They should only change after the game has loaded. So this is the only thing that this script can screw up. If they change for whatever reason before all of this grunts, then yes, then you might have issues and then you can just add this manually as well. But I do like to add this with a script personally, this mode, it's a personal preference of mine. I'm not gonna lie. They now have this. And what we could do, e.g. just for the sake of argument is we can just say, Hey, just print out my, my thing. So in the module script that we've created last time, we're just gonna do is we're going to print spawn location dot. And this should have a thing that's called checkpoint number. So it's born location dot checkpoint number, that value. So every time that the player now touches the spawn location, we should get the value out printed out. So let's just see, right, so we should be able to move over here, and then maybe we should move over here. And if we touch this, you can see one. So it's going to print out one. Okay, Interesting. Let's continue along and let's see if we reach the next one. We now have two. And if we continue along here, we now have three. And this is going to continue until basically, well, I've run out of checkpoints. So if we hit this one, we have four, and if we continue along here, then here we have five. So that's really awesome. So we can now get the value or whatever stage we're in. We can actually get that via the value over here. And we're gonna do two things. The first thing we're gonna do is we're gonna make a little bit of a GUI. So this is gonna be a starter GUI, and we're just going to call this the screen GUI. We're going to add in a text label. And we're just going to make this a little bit bigger, something like this. So this is just of course for demonstration purposes, right? I mean, in reality, you probably want to make this a little bit nicer looking, but a nicer looking. You can always change that. That's the big thing. The interesting part about this is the functionality for me at the moment. So then we're just going to call this, I mean, maybe something like zero, that's going to be fine. We're gonna make it this way bigger. So this should be like maybe something like this. Maybe call it a 69. Nice. Yes, that's good. And then that's pretty much it, right? And we can change this in a moment. So what we're gonna do is we're gonna go back to our module script and we're going to add a new thing. And that's gonna be a local function that is not even called from outside of it. It's actually going to be called by this function right here. This is gonna be the add player GUI. And that's just going to be the function. We're going to need a hit and a number, okay? Then we're going to get the player over here. We can get the player up by doing the same thing that we did here. So now we have the player in this function. We can then say player, player gy, Gy. This is our screen GUI actually. So we want to rename this to GUI. Yes, right, So this name has to meet the same as this name dot checkpoint number. We're going to rename that as well. So this is the checkpoint number. So the text label, we're going to rename this to checkpoint number dot txt is equal to, and then we'll make this equal to stage and then plus whatever the numbers and that is going to be, and that is going to be our text. We always have written their stage and then whatever we have. So actually let's do change this as well. So let's say this is now staged zero. I think that that makes sense, right? Stage zero. There you go. And every time, every time we want to hit this, we want to change this. So instead of printing this out, we can literally just say add player at later GUI passing in the hit. And then the number, which is exactly the spawn location Check Point number value. And that's all that we need to do to add that already. And that is actually awesome. Because now if we go in here, you can see we're at stage zero. Now once again, like I said, this does not look great. You can of course change how this looks, right? We've, we've talked about GUIs before if we continue and I go here, of course, wait a second. I did an OOP, see over here I did a plus over here. This, this should be dot, dot. There you go. That's actually what you need to do. Sometimes lower does things a little bit differently than other programming languages, but that's totally fine. And then there you go. And now we got stage one and we can continue along here. And you will find stage two and stage three and so on and so forth. Absolutely awesome. So now you have a display in the gy, but that's not everything that we want. We of course, also want a leaderboard to compare our own stats with stats of other players. Now for the leader stats, right, we can pretty much almost copying the same script that we've made previously. So in the server script servers, we just wanted to create a new script and we're going to call this the leader stats, liters stats. There you go. And I will actually copy over the previous scripts. So this is the script from Part 16 of the base Roblox basics where we added the leader stance. Now, we don't want a experienced value and we certainly don't want a gold value. But what we do want is we do want an int value here. So we're going to rename this to, let's call this stage, and that's the value zero, That's fine. And then that's literally it, the right, That's all that we need to do here. Now of course we still need to change this, but that's okay, we can do that. So in the checkpoint script right here, when we add the players UI, what we can do is we can make a new method and we can just call this change later stats, right? Making it as a new function once again with the heat and the number. And then there you go. And what we can then do is we can then get the player again, because we will always need the player. And what can we do now? Well now we can in theory, just go inside of our goal pickup that we've made once again in the previous things. And we can take parts from that. So we can, first of all get the leader stats right? So liters is equal to player dot leader sets because that's always going to be the same name. Then we can say local stage. Stage is equal to liters and liters stats colon, find first child. I'm going to call this the stage because that's what we call it in here, right? This is the same name as this one, stage. And then if the stage is actually present, oh, no, it's stages present. Then what we're gonna do is stage dot value is then equal to the number that we're getting from the change leader stats function call. And we can just glittery call this right here. And we can call change the leader stats passing in the hit. And then the same thing here, spawn location, that checkpoint number, that value, and that's it. That's literally all we need to do. And now we also have a custom leaderboard. So if we were to run this again, what you will find is that so now we've got the leader sets over here. So not only I can see my current stage, but everyone in the instance could also see my stage. And you can see they both updated pretty much at the same time. And we can continue this number two, and so on and so forth. Absolutely awesome. So this is pretty much a almost functioning Abi at this point. Now it's just about adding more and more stages and more and more things. And you can see how each individual part seems very small and sort of like a contain thing. But now you can see hopefully that if you combine certain things, you can create really, really cool. Well, it basically game effects are about that. Is it for this lecture right here? I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 39. (Roblox) Adding Disappearing Stairs to the Obby: Or let's continue with the RB here, follow robotics course and in this lecture we're gonna be making our stairs disappear. Yes. So I previously mentioned that when you walk up the stairs, maybe what should happen is that each individual stair actually disappears when the player touches it. Now there's a couple of ways that we can do this. We're just going to add a script to our part. And then we're going to add that particular scripts to all of our different stare parts. Basically, for this, we're just going to plus over here at a script and we're going to name this script the disappearing stairs. Now that script, first of all, it will of course have the part itself and that's just script dot parent should be fairly self-explanatory, right? We're going to take the parent of the script. And then we also wanted to do a local disappearing equals false. This is a Boolean. This is just going to make sure that our Touched event that we're going to implement in just a moment isn't going to get called multiple times a second basically. Now we want to use something that we have not used before, and that is the tween service. So this is actually a very good moment where we can basically test this out. And the idea of the tween service is just to move smoothly from one value of a certain thing to another. So we're basically changing a particular property. In our case, we're going to change the transparency from zero all the way to one. And then once that is done, we're going to change it back to one, 1-0. So how does this going to look like if I just play the game for just a moment and we're going to switch to the server over here. We'll select this part. And then the idea would be that the transparency, right moves from zero all the way to one in a smooth fashion. And then once it's one, we're going to wait 6 s and then it's going to go back to zero. Now this can be done as we've previously seen with a for-loop and a little bit of a small weight function call, and then you just change it by, I don't know, 0.1 or 0.01 or however much you want to change it, that does work. However, it is not the optimal way. The optimum way would be to use the tween service over here. And the way that this works is you have a twin service variable. This is equal to game colon get service. And inside of here, we need to specify the servers. Now you can see there's a lot of services. We've not really talked in detail about this, and we're only going to take a look at a few services. But now I want to use between surface over here. This is between service and then we also want an inflammation. So this is tween information. This is actually fairly straightforward. I will explain this as well. So this is gonna be between info. Let's just do it. Call it like this. I'm going to call it with a small t, not a big one because otherwise we're going to use the class over here. We want to make this a lowercase t. And there's gonna be tween info between info this time with an uppercase T dot nu. And then here we can specify the time. So the time is just how long is it going to take to get from the value that you're currently add that the properties Kronecker to the value that you want to reach. We're just going to say 1 s. And then the easing style, we can just say this is going to be the enum dot easing style as you can see, and then dot and then you can see there's a bunch of different ones. So linear is the most easy to understand. It's just a linearly drawn graph, right? So from one point to the other, then there's also a balanced, basically bounces back a little bit. This doesn't really apply in our case because while you can't go above one or zero in transparency. And then there's other things, right? So you can see there's cubic. So basically it starts at a lower speed and quality. You can see this is determined by a quadratic interpolation. So there's a bunch of ways that you can basically ease this in and out. What I recommend here is that you can just try a bunch of these and see what they do. Once again, in this specific example, it's actually not the best way to take a look at it. Tweening the transparency here is not actually going to do that crazy thing, but anything else could be interesting in deed. So we're just going to choose linear for the time being. We don't need to make this too complicated. Like I said, you can just try out a bunch of them and see what they do. And now we actually want to make a new tween, right? So we're going to just call this part. This is going to turn the part on and make the transparency go from whatever the actual values to zero. Meaning zero transparency just means that it is completely solid. And we can see this is going to be done by doing tween service. So our variable over here, colon create, then we want to say what instance. So what actual part is going to be trained and the part is going to be part should make sense, right? So we want to change the part. Now. We want to provide it between info. Now we already made this, that's perfect. And then we want to make a table over here. So the table, of course, is just going to be curly brackets. And inside of here, we want to tell between what are we going to change. We want to change the transparency, making sure that we write this correctly, right? So transparency and two, what do we want to change this? We want to change this to zero in this case. So making sure that the, this word right here is exactly the same as the name inside of the properties, right? So this one has to match exactly to this one. So please do pay attention to that. If there's even the tiny cyber like this, it won't work. If you make sure that that is fine, then we can just copy this line. So just select this press Control C and Control V to paste it back in. And we're going to call the other one part off over here. And in this case we want the transparency to be one. So if we play part on what it's going to happen is it's going to within 1 s, change the transparency. Apart from whatever the actual value is, zero. And if we play part of the value of transparency is gonna be changed to one from whatever transparency value it has at the moment. So we're going to say part dot touched. So we'll use the Touched event. We're going to connect this with a function. Of course, we want to know what headed and what we're just going to do is we're just going to go into our trusty old server script service and we're actually just going to take the, this one right here, the if statement because that basically checks whether or not a player has hit or a character has hit at this particular part. And we will also add another thing and that is disappearing. But we want to say it not disappearing, right? So the idea is that this is going to get set to true immediately, right? So we're going to set this to true immediately because basically we don't want to call this if we're already having the Twin service going. Now you can do this in a lot of different ways. You can also check if a tween is working. I think the Boolean here is totally fine. The idea then is that we are going to wait, let's say for a quarter of a second. And then we're going to say part of colon play. And this will now play the between service making the transparency from whatever it is of the part to one. And that will actually immediately work. So if we go in here and we go to the parts, so let's just take a look at what partners is this, this part. Okay, let's take our stored again. Let's just duplicate this and put it over here just so that we have a little bit of an easier time to get there, disabled the starting part, and then we should be able to spawn immediately next to the stairs. So we small next to the stairs. And if I touched the stairs, what you will find is that there it goes away. Now that is actually pretty cool. Now the there you go. So it still has collision. So as you can see, I'm pretty much standing or nothing because, well, we just change the transparency. But we did change the transparency, which is really awesome already. So you saw that as soon as we touched the stairs, right, The Twin service gut started. So this one right here, that part off and it changed the transparency 0-1 in a linear fashion within 1 s. Now what are we gonna do to, how are we going to make this disappear? We can maybe say in here, well part that can collide and then we could just say false. That is not quite right. Because if we do this, then as soon as we start playing, the thing is actually going to, Well, let us fall through when within a quarter of a second, which might be a little bit too fast. So we can just, let's just take a look at this and see what this actually does. So if we go in here and we try to carefully go on to this part, you can see now it's already like has no more collision. So that has been a very, very fast. So I would say that this is probably not the optimal way to do it. What do you wanna do is you want to say, hey, if the tween here is done, right? So once this is done, then we want to turn off the part. So basically when the part is completely gone and what we could do is we could just say part off. So this is the tween that we've created, dot complete it. Basically you can see the completed event of a tween fires when the twin finishes playing. So this is exactly what we want, right? And we want to connect this to a new function here. Now we can get the state as well. We don't really need the state in this case because we are going to be fine. And then we can just say, in this case, part can collide equals false. So that's gonna be fine. Then we're going to wait another, let's say 0.25 s. Then we're going to say part on colon play when they say disappearing equals false. And then we can either say part can collide true right here. Now I wouldn't actually put the true calculate inside of here because then the same issue occurs that we had before. Where as soon as this becomes visible, it, you can collide with it again. Now that might be a thing that you want. There could be the case, right? So if you want to make it immediately collide Hubble, after you can barely see the part, then you can do this. Or if you wanted only collectible once the part is fully there, then you can say port on colon completed colon connect function once again with a state over here. And then once that is done, you can then say hoard can collide. The logic here should be fairly sound, right? We just have a service or a tween, right? In this case, that it will change a value from one to the other ones, it has reached its target value. The completed event is called, and we're just connecting a another function to it. That is literally all that we're doing here. So it is actually a really, really cool and awesome thing that we can do. And if we have this now, what we can do is we can go in here and we can see if I touched the first stair over here. You can see it now I fell through and let's just go back in there. Let's touch the first series and then continued to go up. So let's just go. There you go. And now you can see it bounces back and there it is again and I can stand on it again and then I can follow through again. So that is really, really cool. Now we have this disappearing stairs script on one over stairs. How can we add it to all of our stairs? I don't know if there's an easy way to do it. I've just been basically just duplicating all of them. So basically just selecting one of them, comparison Control D, and then just, well basically moving them to the other parts. Now, if there's an easier way to do this, then I'm pleased to enlighten me. I have not yet found in an easier way to duplicate parts and set them to different parents easily. But look at us, we're already done basically. So it didn't take that long. So that should be pretty okay. And then let's just close the ports if you want to future proof this, you can also make a module script with this change at about and use that instead and then have the ports just connect to the module script that is of course doable. But in our case, I think that this is going to be fine. And let's just see how this is going to look, because this is actually going to look really, really freaking awesome. So if we now go up the stairs and you can see there now all disappearing and appearing again. That is absolutely awesome. And the other way also works. That is really cool. Now, once again, once again, the stairs might not be the best way in terms of modelling, right? Maybe the stairs could be a little bit bigger, a little bit wider, things like that. You can always change it because now the functionality is in there. Right? Now you have one of the parts with the script. And if you want to redo the stairs, absolutely no words. You can delete all of the other stairs. You can change the modelling, how it works. And there you go. One last thing, I've shown this before, but the tween service over here, I do definitely recommend you take a look at this because it is a very important part of doing a lot of things in roadblocks that just look cool basically. And we will also use this in the next lecture as well. So I do highly recommend taking a look at the documentation over here. You can also do this by simply just going to the between surface over here, I believe, and then display. It could just be a very interesting thing to take a look at regardless. So that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 40. (Roblox) Adding Moving Parts to the Obby: Let's continue with the RB here, follow robotics course and in this lecture, we're going to start moving our killed bricks, right? So I have teased and talked about the moving of the kill bricks for awhile now. And the idea is that what we wanna do is we want to make a script that changes the rotation of the kill bricks, something like this, right? And we have previously seen in the previous lecture, we have seen the tweening service for the stairs, right? So that made the transparency of the stairs going 0-1 or 1-0. And now we want to do the same thing for our killed bricks over here, just with the rotation. So for this in the kill bricks, right, we can just leave the kill script. We can just basically keep that there. And what we wanna do is we just wanted to add another script and that is going to be our rotating script over here. That's perfect. And now this is going to get number one, a part, right? This is gonna be our part, script dot parent. And then we're going to get between service again. So this is between service equal to, we've seen this previously game colon get service and then putting in the tween service string over here. Now we also want information. So this could be something like the rotating information, rotating info. There you go. And that's gonna be equal to tween and foot are new. And then here we want the time again. So let's just say one for the time being. Enum, that easing style, that linear for the time being as well. I highly recommend here, you can definitely check out a different easing styles and we will do that in a moment. Once everything is working, then the question is, okay, how can we spin this? Now this is a little more complicated than the thing you've seen previously, because there's a little bit more math involved. But let's just say we're going to spin this, right? So this isn't gonna be our tween. So there's gonna be tween service colon create. And this will of course work on the part should be, which should make sense. We're going to add the rotating info. And then here we want to add what is changing in as a table. Now what's going to be changing for the kill brick is going to be the C frame, right? And what is going to be changing for the C frame is specifically the orientation. Now how can I change the orientation of the C frame with this? Well, first of all, we're just going to say C frame. And then it's going to be equal to the actual C frames. That's going to be Part C frame. So we're setting it to the same port and then we're multiplying it by C frame dot angles. And the idea here is that this is equal to from Euler angles XYZ. So Angles basically returns you a new C frame from radiant numbers. So this might be a little bit, oh, this is crazy. In general. Rotations in 3D space are actually quite complicated. You might say, well, I mean, it's just like three numbers over here. Well, it's not quite that easy. Three numbers can actually not quite be enough to do orientation and rotation. That's why sometimes when you change those numbers, they do weird things, right? So maybe you've changed this select -90 and all of a sudden, this changing to -90, like the y-value, actually change this to 70 and you're like, well, how did this happen? Well, overall, what we wanna do here in the angles is we want to say math dot radians. So we want to put the radiant in here, 45. And then we want to say closing parentheses zero comma zero. I'm just going to zoom out over here and you can see the C frame. The actual value should be the current value times whatever the angle of math radian 45s. What does that mean? Well, we're going to see this in just a moment. What we've just gonna do is we're just going to say spin colon play. And that's all that we're going to do right now. So we're just going to keep it like this, right? So we're just going to say, Hey, just spin around and then we'll see, we'll take our start over here and we're just going to move it over here. We should be able to see our first kill brick wall do something. And you're going to see what it does, right? So we're gonna do here and you can see that it actually rotates, but it rotates around the wrong axis or it has rotated around their own axis. So to actually rotate it around this axis, which is in this case actually not correct. So we want to change the math over there. So we actually wanted to rotate around the blue axis, which is actually z. So we want to change this two right here, that has no worries at all. So you can basically check out, right if you're like, wait, how do you know that we want to rotate around this axis? All of a sudden, you can see that if I change the blue over here, right, that is going to get us to the desired result. And blue over here at the top right is z. That means that we need to change the last one because this goes x, y, z. Hopefully that is sort of understandable. So now that we change this, right and we go in here, we should now be able to see this rotate slowly around and there you go. So actually we didn't even catch that, but it wrote it around in this direction. And if we go to the server and we select this, we can actually see in the orientation that this changes the value here, 245. So that's literally pretty much all of this does, right? So it basically just says, Hey, we want to change this particular thing to 45. And if we were to go to five e.g. 5 s, then it's going to take a little bit longer and then we will actually be able to see it move as well. So you can see it now it's moving. And now we've reached the 45-degree angle, and that is all that it does. So the idea here is that literally it just changes the angle to whatever you put in here. Most of this stuff is sort of just sort of this calculation. Now, it is interesting to take a look at it. And if you're really interested in that, I do highly recommend checking out the C frame API references. They do, they are quite important, they are quite interesting. However, it is a lot of math involved. That is the thing that you can keep in mind. So now it's going to rotate 0-45. And what if we now want it to rotate back again? Well, no worries at all. We're just going to make a second spin. So we're just going to say this is spin one spin to it, that's gonna be fine. And this one goes to -45. So we're first going to 45 and then we're going back to -45. So now spin one should play, and now this is the absolute genius thing. Now what we wanna do is once that is done, we want to say completed. So we once again use the completed event. We want to connect a new function and we're just going to say function. And in the same line we're just going to say spin to colon play, and then we're just going to end it in the same line. Spacing to that's not quite right spin too. There you go, Right. Now, even crazier, we're just going to copy this as well. I'm going to say one, spin two is completed, we're just going to place spin one now. This will now make it so that it goes from four, 0-45 to -45 and back and forth forever. If we just play this, you will be able to see that. First of all, it goes to 45 and once it reached that bam, it goes back and now it goes to -45, negative 45. And once it reaches that, it goes back again to 45. Absolutely spectacular. And I absolutely love this and are here, or it comes in, is the different easing style. So let's maybe change the time over here to three. And now here, if we get something like a exponential one, right? So this reduces the resist very quickly as between approaches a target. That could be interesting. So let's take a look at this one. This is going to look crazy, right? So if we took a look at this, all of a sudden, it looks completely different. However, this is also a really cool effect as you can see. And that's what I'm saying. Be open to experimentation on things like the easing style, because that actually looks really cool and it can add some unpredictability to your two-year elements basically, right? So we can do this. We can also say maybe we want to say see a sine wave. Sure why not? Let's take a look at the sign. How is that going to look? Well, let's just see, right. So this is going to look quite like this. So it's different. Once again, it's not linear. It's a sine wave, right? So it slows down, it speeds up a little bit. We can also take a look at one other that's kind of interesting. Is the, is it the back? Yes, this one that's actually also pretty cool because it actually overshoots a little bit. So we're going to see that it goes a little bit beyond 45 degrees actually. And then it sort of bounced back as you can see. So overshoots a little bit and then goes back and then it continues to come back. It's really awesome. I cannot stress this enough. Just play around with the easing style over here for a little bit and you're gonna be amazed at what you can do. Now that we have the rotating script done. Well, we can just basically take a look at all of our killed bricks over here. Let's just make sure that we have all the correct ones. So it's all of the ones above it. Alright, and then we're just going to take the rotating script and we're just going to add it to all of them. There you go. Notating script, rotating script, rotating script N. The one more actually, and we need one more. There you go. There you go. Another go. All going to rotate. Now. Now to be fair, they're all going to rotate at the same speed and well, basically in unison. Now what you can do is you can change the original rotation of some of them, right? So that the rotation is going to be out of sync or that does work. So we can do with someone like this. And then maybe we're going to change this guy to something like this. And I'm going to continue along here. Maybe this guy has an absolutely insane thing. Maybe this guy is actually standing on top and then this guy is like already at 45. So let's just see what this all does when all of them move both simultaneously, right? So let's take a look at this. And you can see now all moving, however they are all moving at the same time. It does look very cool, right? I will give you that they, they, they look pretty cool and you can see is that what is 45 degrees actually changes for each of them, right? Because the C frame is, in this case, sort of local rights. So we're basically just changing it to 45 degrees. But what 45 degrees is changes, which actually does have a very, very cool effect. Now there's one tiny thing that I do want to add and that is going to be the following. So let's just open the top rotating Scripture so that we have the correct one. And we're just going to make this a local tween time over here. This is going to be, let's say, equal to one and we're just going to change it right here so that we can change the tween time for each of our killed bricks are rotating kill bricks over here. And the idea here is that we're actually going to do this via a new int values. So we're just going to add an int value right here to the kill brick. And this is going to be the twin time, right? Then we're going to say port dot, twin time, dot value. There you go. And now we get the time from here. So let's call this two. And then we can do is we can just delete the old rotating scripts. So this is once again, one of those things where maybe a module script would be kind of good, but it's not absolutely necessary. And I'm going to just gonna duplicate this and add it to all of our rotating killed bricks. And then there's also a point in possibly renaming them to the rotating kill bricks just so that we know what those are, right? So those are gonna be the rotating or let's say riot killed bricks, that's gonna be fine. That should hopefully be enough for us to be like, okay, those are gonna be the rotating ones. There you go. That's one as well. And then this one as well. And there we go. And now we can actually change this. So let's say we want to change this to six and we want to change this to one, and we want to change this to three. And this should also be three, let's say. Now they're all gonna be completely out of sync because some of them are going to be faster, some of them are going to be slower. And here, you can also of course change the easing styles and see now there are all sorts of just doing their own thing. Basically. They don't even care. And it's gonna be way more interesting to jump around this, I mean, this one's gonna be interesting. There you go, but I did do it. It's just awesome, right? So you can do so many things right now, changing the easing cell of some of them, you can in theory, you would also change the easing cell at some point during the while this is happening, you change between time. There's a bunch of things that you could do. Those ideas. I hope that I basically sort of inspired you to play around with this because that's the most important thing. Because the most learning you will do if you're like, wait, how can I do this or this or this? And yes, Usually you can do it. It just amounts to trying it out and seeing what you can do. But that is basically the movement for our killed bricks over here. And that pretty much sums up the general thing that I wanted to do with the RB. We're going to have one more lecture where I talked about a few things that you might be able to add. But regardless of that, for the time being, this is gonna be it for this lecture right here. I'll be honest, useful and you'll learn something new. And I see you all in the next lecture. So, yeah. 41. (Roblox) Additional Ideas for the Obby: All right, welcome back to the RB here for the row box course. And in this lecture, I just want to shortly talk about a few things that you might be able to add in your OB when you are continuing to develop it. So of course, in our example over here, we only have five stages and it is being played while you can play it very, very quickly, right? But the idea of the army was to be an illustration of what you are able to do. Certain things that you could expand upon would be something like maybe taking the square root of the hole in the middle, right? Maybe making them a little bit bigger. And then you can put them up like this, right. So you can put them up so you get a cigarette, a corridor. The corridor is moving with a tween service. So that could look really, really cool, right? And maybe it could even be a rainbow thing. Maybe wouldn't be a difficult stage, but it's not always about having difficulty in the status. It's also about just having fun stages and having them look cool, right? Because honestly, you know, the look for an RB is like, I would say, somewhere between like a 30 to 60% of what The cool thing about it is, right? And if it has a lot of stages, you just continue to go along and add different stages that are still similar. So you can add more shapes in theory, you could add the shapes and have them be slanted in a different way. I wrote it in a different way. You can add more stairs, right? You can add stairs that maybe they part ways from right to left or something like that. You can add certain parts where you have to choose right or left, right, So similar to this one, but actually one of them is actually calculate his faults. So you're going to fall through this one, things like that. There's a lot of ways that you can go about this and to make this really awesome. And I just want you to experiment if you're really interested in continuing with this, I do actually think that if you just experiment with any ideas that you might have, you can also of course, look at other Abby's, see what they have and then maybe like, Okay, how can I implement this? That is a great way of continuing to learn more and more roadblocks scripting. Apart from that, we are done with this. Now we will actually be back with this particular RB because in the rest of the course, we're actually going to go into some more intermediate topics. And most of them, I basically want to show you inside of this RB in this case. And that's hopefully going to help you make your own custom Roblox game as well. There's also some ideas of future additions, how we can improve this, how you can keep improving your hobby in this case. And what I mean, that would be it for this lecture in this section of the course. I hope you've found this useful. And if you did so far, I would really appreciate a review from you. Otherwise, I will see you in the next lecture. So, yeah. 42. (Roblox) Publishing your Game: All right, welcome back for the intermediate topics here follow Roblox course and in this short lecture, I will show you how you can publish your RB or any game really to the Roblox itself. So to do this, we just want to go to File and then you will see that you have a published to Roblox over here. Now we're going to choose the published to Roblox as this will then basically open up a new window over here. Now these are some of the things that have already published. Not all of them are private in this case, but I can go to create new game, and this will basically create a completely new game. Now we're just going to call this our example, OBE e.g. somebody like that, nothing too crazy. I am the author here. You can even change the genre in this case. Now, you can keep it at all. Or you can say, this is a, sort of a medieval themed or B, something like that. It's fine. We're going to just keep it at all. Now, usually the devices, we've only really tested this for the computer. So if you want to be absolutely saved, you can turn off the phone and the tablet because, well, we definitely know that it's going to work on the computer. However, you can also keep those on, but do be sure to test your game as well if they work properly on the phone and the top, if you so choose, you can add a description over here. Otherwise you can just hit Create and this will now upload the RBA onto roadblock. So you can see we're actually loading our place already. Just be patient for this. And then there you go. Now we have the file over here with a little bit of a cloud, and that means that we are now on the server. So now just navigate to create that roadblocks are com slash creations. And I'm just going to reload this and you will find our example, albeit right smack down here, as a new experience that was created. That is really cool. And you can see this is not the thing. If I go to edit in Studio, it's actually going to open Roblox Studio for us. So this would actually open a new window. So right now you can see Roblox Studio is opening again. Now in our case, we actually have this already open. So it's gonna be like, oh my God, we have already open. So there you go. We're gonna just gonna close this. And now we have it open here as well. So this is really, really awesome, but this is not everything. So you can of course go in here. Let's just go in. We can also change if these things so you can see we can make it public, we can shut it all down. We can create badges. There's different statistics that you can take a look at it. You can even configure the localizations end. So first of all, we can open this in a new tab. So this is gonna be our creation over here. As you can see, this is just the overview. There's other basic settings so you can change the name if you so choose to, you can make it private. This is a very important thing as well. So enables to do access to API services. This is the thing that we'll come back to in a bit. I highly recommend you turn this on already and just save the changes. However, we will go through this one more time. This is needed for certain APIs, such as the data storage API we will be taking a look at very soon. There are places. So right now there's only one place, right? So it's just this RB in this case. And usually for an abbey, you only have one place, but you'd have multiple places that are connected via certain teleportation pads or certain gateways or whatever you basically want. And we're also going to see this in the intermediate steps here as well. There's other items so you can create badges, that you can create passes, and you can even create a developer products will not go into those in this course. But there is still an interesting thing. There's different access types. So the access types here would be whether or not it requires a payment to make a private server. So you can say requires x robotics, things like that. So there's a very cool that you can do. There's a questionnaire which were not eligible right now. There's localization, so this would actually translate certain things. This is absolutely crazy. We've not looked at the localization of service, but it's really cool that this exists. We can also add some social links. So this would be just be social platforms over here. We can get some updates. So this is a great way to notify the user. Basically, you know, something happened. There's notifications. So we can create notification strings and then advertising and sponsoring actually goes to a different window. And then at the end here there are developers stats basically saying how many people on what platform are playing? What is the historical data? There's a lot of things in here, which is really, really awesome. But if we go back to the experience right here, what you can do is you can go to view on Roblox. And what's going to happen is that you will see the probably, as you've seen multiple times, this particular window. And what's really cool is that you can once again go over here to Edit and then it's going to once again open it in Roblox Studio. Now we'll actually don't want that, right. So there's a bunch of things, right, configured this place so we can actually configure this is the old version. If we go back to the new version, you can see here we can now also change the icon and stuff. So there was actually a big thing that I wanted to take a look at and the way that you get this through the creations, right? So if we're in this creation screen, you go to your Abby, then you go to places, and then you click on the place and then you can change the details, right? So you can change the icon right here. You can either do the automated image or you can even change this. You can change the thumbnail. So the thumbnail would of course be this thing right here, right? You can actually see on roadblocks. So if you are on robots, this big thing right here, and then there's access to this. How many visitors are available? Usually you want them all to be like the service settings. You all want Roblox optimized version history. So what are the versions that were implemented? And then lastly, some permissions. Right now, most of those aren't important. I suggest you keep most of this default rate. So if we now click Play, right, it's not actually going to open. Roblox Studio is actually going to open Roblox itself. So there we go, our example OB by counting Joel and we're now joining, and there we are. Now we're inside of the game and this is actually roadblocks. This is not Roblox Studio. And if we go on here and go over here, bam, stage one, this works. We can still die over here. And that is pretty much all there is to it. I mean, that is really good. So it definitely works. I highly recommend frequent testing. Let's see the stairs. They'd also disappear and also fell off. That is not quite what I had in mind. Please excuse the fact that there was no volume. I turned that off, but there you go. So now you get the saws over here that are rotating around, right? There you go. Oh, this one's crazy. This one's a this one's a crazy one. That one's actually good. I like that. And then we got our shapes, and there we go. So now we actually have the game over here. Now of course, it is still a little bit bare bones, but this is the start of creating game and now it is published, is not yet public, but that you can of course choose to make public or not. Once we're done with this, we can go back. Once again. The big one is the creations. And there you can basically access all of your creations. So you can go to your example or B, and you can change everything that you might want. Now the reason it's so important that we published this is because we actually require our place to be published before we can use. Well, all of the things that we're going to talk about in the upcoming lectures. But that's basically going to be it for this lecture right here. I hope you found this useful and you learned that the New, and I'll see you all in the next lecture. So, yeah. 43. (Roblox) Add Pictures to your GUI: All right, welcome back to the intermediate topics here, further roadblocks course. And in this short lecture, we will take a look at how you can add a image to your GUI. So the reason why we've not been able to do this when we actually first looked at GUIs, is because images actually have to be what they require your place to be published, right? So if I add an image over here, right, so we add an image label, as you can see now we've got an image over here. Let's just add this inside of the size here. That's gonna be totally fine. This is going to change. Now. To change this right, you click on the image and then you just go down to the image right here. And you can see, we can now add an image. Now to add an image, we're just going to choose a file. I've prepared a thumbs up button over here. I think that that's going to be totally fine. We're going to call it a thumbs up and we're going to create, this will actually upload the thumbs up button to Roblox itself. So you can see net now has a roadblocks ID, and that ID is actually important and will now be available. Let's make this a little bit nicer. Maybe let's actually make this a little bit smaller, even number like that. And then we're going to do this. There you go. So now we've got this. Let's also remove the border because I actually don't want any border. No, I wouldn't like zero border right here. There you go. So now we get a thumbs up over here next to your stage. Right now we're not doing anything with this, but it is pretty cool, right? So that is pretty much how you can add the image. If we now save, you can see we now change, we now saved those changes to Roblox, right? So if we were to navigate back to our creations and we go to our example, I'll be end at the places instead of a place in the version history, you can see we just pushed the newest version because it is a safe. And if we were to publish this now, we will once again go to publish to Roblox and then it will actually published this as well. So now we're publishing the changes. There's two different operations, right? But if you go back on the version history again, you can now see, now this is a published version. So there's a difference between saving your changes in publishing the changes. This is a very important thing to keep in mind. Okay? So when I add this and I saved it, right? So I, I pressed Control S or you go to File and Save. This is means that it is saved on the Roblox Cloud. You can restore early versions and as a saved as an early version. This is a snapshot for all the changes that you've made. However, just because you saved, it doesn't mean that the people playing your game are going to have those changes. To get the changes to the people who are playing your game, you actually have to publish the version that is very, very important and it's a very important difference for you to know when you're actually trying to basically do this. One more tiny thing is you're probably going to ask, well, how can I change this image if something were to happen? Well, let's just for the sake of argument, uploading another image, right? And that's going to be the thumbs down. There you go. It's also going to be a thumbs down. Let's create this as well. This is gonna get uploaded and it's going to get a new ID over here. So now we have a thumbs down and let's just say for the sake of argument, we're just going to add a local script over here. The local services is gonna be the image changer, zoom in a little bit and we just wanted to get the image. So the image is of course, script dot parent should be fairly self-explanatory. And then we're going to say imageView.image. Please keep in mind that the variable is called image with a lowercase I. And the uppercase I image is actually the property right here that points to whatever image we have is just equal to. And this is very important. We basically want to get the ribulose URL so the image is equal to HTTP colon slash slash www dot. Roadblocks are com slash assets, such question mark id equals and then you can do a dot dot and then you're just going to get the image ID to get the image ID. But I just select the image label and then select the image that you want, right? You can, you can just select it and then you can copy the ID from right here. And then let's just make sure that the default image is actually the thumbs down. And then we basically want to change it. So we're gonna go back here. We're just going to add this right here. And that should be fine. Then we can save this. And you can see I'm actually applying the edits right here. And this is once again saves two roadblocks to the Cloud and we should start with a thumbs down. However, it's actually going to change this to a thumbs up once we start the game, because the image change, your script is going to run. And there we go. Now we actually got a thumbs up because, well, of course it changed the imagery right here. You can change the image here, right? When, when anything really happens, if you're a player dies, who maybe change it to a thumbs down, right? And when they reach the next checkpoint, you can change it to a thumbs up. Now, do be aware that this is a local script and that the standard GUI is local. So if you're trying to do this via a normal script over here, it might be a little bit harder to actually get this to work correctly for the time being, this is the way that you change an image though, right? And that's actually going to be it for this lecture right here. I hope you found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 44. (Roblox) Storing Player Data with DataStoreService: All right, let's continue with the intermediate topics here for the robot scores. And in this lecture, we're going to take a look at the data storage service. So the data storage service is an incredibly powerful service that allows you to store player data onto the Roblox Cloud. Now this is not only really cool, it also allows you to do things like, well, let's say your player has actually played your ABI before they reached stage two. Now what's going to happen is that if they were to exit the game and join again, well, they're gonna be spawned at the start again, right? So they lost all their progress because their progress wasn't saved. But with the data storage service, while we can actually save the progress in and in a file online, in a table somewhere, and then retrieve it when the player joins and again, and that's exactly what we're gonna do. So let's just take a look at how we can do this. So the surface itself is actually not that complicated in these servers, web servers, we're just going to create a new script and we're going to call this the load checkpoint script. And the way that this works is well, we first of all, of course need a while data storage service. So there's gonna be a local data storage service. This is equal to game colon get service. And we want the data storage service right here. That's amazing. That's the first thing. The second thing is that we want a specific store. So the idea is that in the data store service, you have a bunch of different, let's say bins. And in those bins, you save all of the data. So what this is going to do is we need a local and we're just going to call this the checkpoint, checkpoint store. And this is equal to the data storage service colon get Datastore. And then we wanted to name this. Now this is incredibly important. We're going to call this the checkpoint store. Every time we want to access the store, we need this specific string. This is our unique key to identify what data store we want to access. And it's incredibly important that we got this right, but we gotta data storage service and we got the checkpoint store over here that stores all of the information. So the next thing we wanna do is I want to do the same thing that is done in the leaderboard. And that is the idea of the player added over here. So we're just going to get the players as well. This is usually a thing that you want. And then what we wanna do is we want to copy the player added event over here. I mean, we can also just type it out, but sometimes you can just, you can just copy this as fine. And this is going to be a function. And the function here is get checkpoint data, right? We're gonna do this and we'll put this into the connect over here. So we're gonna do get checkpoint of data and we also can actually get the player for this. Of course, There you go. So now we have the player here as well. And that's actually very important because we need the player ID, right? So we need a key under which we save all of this. So the idea is we're going to make a key. So this is going to be the checkpoint key. And this is equal to, usually what you wanna do is you want to say player dot, player ID, and it will do dot, dot, and then we'll do dash. And then you can e.g. say dot dot again. And then you can say checkpoint e.g. and this is going to make it so that the key is specific to each player because the player ID is unique for each player, therefore, this should be no issue at all. Once again, though, this key always has to be the same. Otherwise you're not going to be able to retrieve the data or to get the data. It's gonna be very interesting. So we're going to make a local data equals zero right now, and then we'll do it the following milk, a local success or error message which is equal to P call. I'm going to explain this in just a moment. Instead of the P call will make a new function. And this is going to be data equals checkpoint store. So now we'll go into, go into the store, colon, get async. So we're going to get whatever data is in there asynchronously. So we're not going to wait until this loads. We're just going to say just get it whenever you can. And we're going to get the data for the checkpoint key for the player that has just joined us. That is the general idea. Now, after this is done, right, this is very important. We want to check whether or not everything has worked. So we're going to say if success, then we can return something or we can, we can do is thing we want to say else, right? But this would mean that it's not successful, then we actually wanted to do error. And we want to say a datastore error. It doesn't need to be called exactly this, but just in case. And then we want to put out the error message right here, right? And if it succeeds, we can basically proceed. We're just going to call this right now. Proceed to change, change the store, Change, change the checkpoint, will do this in just a moment. But the idea here is that we're going to read this key over here and it's going to say, Hey, just pull the get async function over here with this particular key, which basically gets us whatever is stored under this key inside of our data store. The reason we're using peek hole you can actually see runs the provider function and catches any errors. So the general idea is that this is why we have that success and this error right here, the P code basically just makes sure that if there's any error that occurs on the get acing, your not properly connected to the Internet or there's an outage or the servers crash or whatever it might be, it's going to lock this under the error message. And if everything was successful and we're just going to get a true under the success. That's Leary, all that we do. So right now for the time being. I just wanted to print out a success over here. If this is successful and a white arrow right here, if it is not. So let's just save this for the sake of argument. Let's just run this inside of the game and you will see what an interesting thing that's going to happen if we play this now, just like this, you can see first of all, player ID is not even a member of a player's account and that's fine because it actually called User ID. I did do a loop, see their leader that should be user ID. That's what we wanted to use. And then it's the same idea as the player ID. What if we do this now? Now we get this error anymore and we get actually a success. Now that's really cool, right? So we have loaded some data in that That's interesting. Now the real question is like, what did we load in though, right? So if we just say success data here, we're going to get an interesting thing, right? So what data did it actually load in from the get async? Well, let's just take a look. And it got, because you can see it got a nil, right? So because in sight of the data over here, we've written mill, that's not quite right. That is not exactly what we want. We don't want this to be nil. So what we can do is we can say n data basically saying, well, there should be something written instead of the data. Otherwise we're not really successful. Like it's not a success. If data is nil, that's not right, we want, so let's just do this, right? So only if success and data is present, then we want to print out successful. Otherwise we want to print out the error message. And if we were to load this right now, you can see we're still getting a nil, but now we're actually getting the node for the error message because funnily enough, there is no error message, right? Okay, So that's interesting. We want to stop and we want to change this to an else, if not success, then do this and then we go now we have done this. I've specifically done it like this so that you can go through the logic why you need each individual step, right? You don't want to really do a success if data is nil, right? That's not right, That's not correct. You only want to output the error message if it's not successful because then we know, okay, that's all fine. So if it gets a little bit more complicated, that is just the nature of the intermediate steps now, because we're using way more things and we're connecting way more things. But for the time being, we'll keep it like this. Now proceeded to change the checkpoint. Now how would we do this, right? So the checkpoint is done in the checkpoint script right here. And this is actually really cool because the checkpoint script actually creates a, as you can see, a checkpoint of data right here. Now we can literally just take this and actually change this up. So we can just do this, we can take this, and we're just going to do the same thing, right? So if we successfully read something in, we're going to make a new instance. Now in this case, the, this is a, this is the checkpoint data right here. So what we're gonna do is we actually want to do the exact same thing right here. So I'm gonna go all the way to this, right? So this one right here. Now what we're gonna do is we're just going to throw this into another function because I think that keeping the screen is a little bit better. This is gonna be the create checkpoint system. Maybe system is not the right word here, but that's gonna be fine. We can change the name of this in a moment. Checkpoint data. Sure, That's fine. Rate checkpoint data. So we're going to call this right here. And the idea is that this will only be called once, right? Because if the checkpoint data is already created by the first-person being added to the server. We don't want to create it again, but if it's not, then we're just going to create it. And if that is the thing right, after we've created this, we now want to do while exactly the spring, right? So we want to change that. We want to get the child of the user ID right here. And once again, what we can actually do is we can basically get all of this except for the player added right here. We don't want that, we only want this. And then this is going to be another function. And that function is going to be a get or create checkpoint or player. And this is going to look like this and then just add an end over here. And that's very important. There you go. Now we don't have the checkpoint data. That's fine. We can pass this in. We don't have the player. We can, we can definitely pass the player in. That is going to be absolutely no worries. So if we were to call this get or create the long name, but that's fine. So we can pass in the player over here. There you go. That's fine. And then the checkpoint data we have not passed in. So let's think about how we can basically get this. So we could do a very interesting thing and that could be the returning of this, right? So we can return the checkpoint data right here. And we can return to the checkpoint data right here. And we can make a local point data, right? And then we can just pass this in. There you go. And then we're just going to say point data right here. So e.g. that can be a very easy way to do this. Maybe you've not thought about it like this, but they could, of course, that would be totally fine, right? Either we've created the checkpoint data right here, or we or we read it in from the data from the server storage. And if that's the case, then we just return that. And because it's needed in this function, we can just pass this in right here. That's all there is to it. However, the one thing that we of course, also need to do is we need to make sure that the checkpoint dot value is equal to whatever data we've just read it. This is gonna be the stored checkpoint. I think that that name is good. That's going to be good. And we're just going to set that equal the value of it to the store checkpoint. And we're just going to pass this in right here as well. That's going to be data. Now in this case, we actually don't need to check whether or not a data is nil. Because we've said if success and data, we are already checking whether or not data is nil, right? Because if N data basically means that it's not nil, that's the general idea. So for that, we basically get everything that we need. In this case. So if we're reading something in, we're actually getting the correct data via the checkpoint servers. If we had a success and data was probably read in, we're getting a success printed out. Well then creating the new checkpoint data on the server storage. This is the local server stores. So this is the server itself that we're playing on right now, not the same data store. Those are two entirely different things. Now they have a very similar name, right? In this case, they actually have the same name, right? We have the data, checkpoint data right here, Check Point store right here. And we have the checkpoint with the data here from the store. I understand there's a few levels of abstraction that you need to be able to keep in mind. At the same time, the data storage is basically like a, a big old, That's the archive that somewhere on the server far, far away that you don't even know where this is, right? That's the archive. You can access the archive by getting the service and then getting a specific store. This is like getting a specific file cabinet. Let's say you take a specific file out of that file cabinet by checking the user id with the checkpoint over here, that's the key. And then you get that data out of there right at that data, e.g. if it's three for the sake of argument, if this is three, then you're creating on the server that you're playing right now, all of this craziness right here, and then saying, okay, our checkpoint value that the player should small, that is three, and that's pretty much what we're doing here. However, one big thing, and this is the thing that is not done. We're not saving anything. We're right now, we're just reading it in, okay, So we can also read something. So let's make another function over here, and we're going to call this the set checkpoint data. Let's actually do this. There you go with the forest specific player once again, and that's gonna be players dark layer removing. This is fires when a player is about to leave the game. Very important, removing colon connect. And this is gonna be the set of checkpoint data right here. And without the parentheses, of course, There you go. So how do we set the checkpoint data? Well, first of all, we need the same point over here. So that is the thing that we need. Now we actually need the checkpoint name already. So let's say this is the get or create, the checkpoint for the player. Now this actually sets the value for us, which is not quite what we want. So what we can just do is get this particular part over here. So we should get this the actual checkpoint. Now we don't have the data right now. That's fine. We can create the checkpoint data now actually I want to rename this to also do get or create checkpoint data because that is a way more accurate. And we're going to just change this right here. And once again, we can just get the checkpoint data. By doing this, we can just say get or create checkpoint data, find the first child of the user ID right here. And now we have the checkpoint and the value is going to be, this is going to be the data that is supposed to be saved. Checkpoint dot value and the ego. Now how do we save this? While we do the same thing, we do a local success error message equals P call, making a new function in here. And then we're going to say Check Point store. This is our Datastore colon set async. We're going to pass in the checkpoint key, and then we'll pass in the data. And there you go. And that should be everything that we need. Now of course, you should also do an if not success. Then we want to output an error and we're going to say, cannot properly save data and then output the error message here, just so that we have this, it's always very important to lock your errors. And now when a player is removed, right, when they leave the game, in theory, it should save the checkpoint and when the rejoin the game, It should get that checkpoint that was saved, right, the data that was saved, and that should be pretty much all we need here. Now, this might look pretty complicated for the time being. Now it is, right? We have like a multiple functions. We're doing lots of different things. We have some branching logic here. I understand that this is quite a lot at basically take in at the same time. This is why this is the intermediate topics. It gets more and more complicated as we go along. But hopefully the general logic is sound. So let's just save this and let's actually see if everything works. There might be an arrow here or there, but I think that overall this should be fine. And then I'm going to explain another thing that is quite important here. So let's just join in. In theory, we should join in at stage zero, everything should be fine and no errors are present, and that is absolutely amazing. So if we were to now go on right here and go here, now we are at stage one. If we now stop this for now, save the data. Now we actually get this and that is kind of save the data, cannot store instance in data storage. They resort to only accept a valid UTF-8 characters. Okay, that is fine. So the question here is that what is the actual value that it's trying to save? So that is the next thing. Oh, yes, this is actually, I know what the issue is. Of course, if we actually go back to the logic here of the checkpoint script, the value in check point here is just the spawn locations. We actually want the checkpoint number value right here, because that is not a thing that is actually saved. So if we do the following, if we go in here and we save dot checkpoint dot value, now we're actually doing this correctly. And the same thing goes in the other way. Now, we're just running into an issue. Saving is absolutely no worries. So saving we can do this, no issue whatsoever, but loading in is now a little bit harder. Simply because of the fact that well, right now we got the number for the checkpoint. Okay. That's fine. But how do you get that checkpoint? How do you get the correct checkpoint for the number? Now what you can do is we have this very handy dandy checkpoint numbering script right here, right? And that one could actually prove way more useful than you might think, because right here we get the children of all the checkpoints in with this. So this should be actually all that we really need. I'm thinking of the idea of making a table over here, right? So this would be our checkpoints, which is equal to a table that's empty right now. And then you can do table dot insert checkpoints. And then the value is going to be, there's gonna be count and the value is going to be the checkpoint itself. So that's gonna be jackpot. I believe this smartest way to actually probably do this is to go into the server script service right here and make a module script, right? We're going to make a new, this is going to be our checkpoint table. Let's say we're going to actually rename this to check points as well, right? Not turning the checkpoints right here. And now what we should be able to do is instead of the checkpoint numbering right, when we can require this. So that's gonna be our table. Let's call this checkpoint table shore. This is require. This is gonna be the game server script service dot checkpoint table. And the checkpoint table, we should be able to do the following. Now, insert checkpoint table counter checkpoint. So we are now inserting things into the table, that is the module script, right? And what we can do, let's just save this for a moment. And inside of the load checkpoint here, we can get this as well. There's the local peck points equal to requires game server script service dot checkpoint table. And this would then be checkpoints, brackets, store checkpoint. There you go. And I believe that that is probably the cleanest way of actually doing it. So success one is loaded, that's fine. Let's just for the sake of argument, are over here, and let's do this. So now we have one loaded, we're going to stop. This is a safe, That's fine. Let's Play again and we are still spawning at the start, which is very interesting. However, we're not getting any errors, which is actually pretty good. Unexpected happens. We might actually do have to take the character added white right here into our loading script. And I would put that right after we're setting the value right here. I believe that would be the idea of this and that should do it because the character added here should be called after the player is added. So let's just try and add this under the value that you're already changed the spawning location because that's the only thing that we really need to do, right? We only need to spend to change the spawning location. There we go. It immediately works. That is absolutely amazing. So you can see sometimes there is a little bit of the ***** right here. So if you go to two, I can jump off of it and I'm going to respond to two while I'm in the game, right? So we're going to respond at stage two. There you go. And if I stop this right, we're now saving the two again. Once again, no errors. Absolutely amazing. And if I were to play again, not only are we going to see success to appear, are also immediately going to start at stage two. Absolutely freaking awesome. So what's very important here is that you can see sometimes there are the connections. There's a lot of connections that are sometimes hard to untangle. You can see like the way that we did this, right? We had a, we are now have a checkpoint table over here as a module script. And we're saving the checkpoints via the checkpoint numbering script right here. And then there's also the load checkpoint script which does a load of stuff, right? So I'm going to try to summarize this in like 2 min so that it's understandable. So we have a data storage service. This is an archive, and the archive stores many, many different file cabinets. Now the final accommodate, you can think of this as a data store. The data store is a file cabinet. This can contain a lot of different files. Now once we have our Datastore, we can then access certain files via a key, right? So we can get this key. In our case, we're making a key using the user ID and then just dash checkpoint over here, just so that you have this. Then we're getting the data from this particular file cabinet by saying checkpoints stores, this is the data store, colon get async, and then passing in the key when that returns the specific data stored in with that key. Now, in our case, this is going to be the number associated with our checkpoint, right? So it's either going to be the first checkpoint, second checkpoint, so on and so forth. It is true, right? And if we have successfully retrieved that data, then we're creating the checkpoint data, and then we're creating the checkpoint for the actual player. Now, these two functions over here are very similar to the functions inside of the actual checkpoint. If we look at the checkpoint script and then we get to the checkpoint module over here. It's gonna be this one right here, right where basically just creating the same model, right? And then calling a checkpoint data and recruiting the same object value in this as well. And the idea of the object value is it saves the actual port, read the actual checkpoint part, the physical port inside of the game. So if we go in here, it saves this particular part as the checkpoint where the player should respond. And we now want to get this with the number. Now the issue is the number and the actual checkbook port or a completely separate from each other. They don't really have anything to do with each other, which is kind of an issue. The way that we solve this is that while we're numbering the checkpoints, right? While we're numbering the checkpoints, adding the int value to them, we're also adding them to a table which has the count. And if we have the count, then we can get the checkpoint part. And by doing that, we can then require the checkpoints right here, the checkpoint table module script. We can use checkpoints, store checkpoint to get the actual part of it over here, right, the game object, the actual object. And then we're just saying, hey, once the character is added, then just change the frame of the character, which is basically the position of the character to the checkpoint itself plus for higher up. So we're basically going to spawn a little bit higher than the checkpoint, fall down onto it. There we are. When we're now exiting the game, when the player is being removed, we're then taking the same key, are basically unlocking the file cabinet. Again being like unlocking the file cabinet, getting the beginning of the file and saying, hey, now set this file to the data that I specified over here. And the idea is that we're going to get the new object, the object that is currently our checkpoint. We're gonna get the value from the number there and bam, there we go. We're gonna get the number from that and then saving that under our key once again, one more important note here. Now we're talking about saving data. And it is incredibly important that you are very careful with how you save data and that you probably add the a safes and checkpoints and errors and all of this. Because when the data is gone because of your negligence, then people might not be happy, especially if there is certain if there's robots involved. Right now we don't have any robots involved, so it shouldn't be too bad. But I'm just saying be cautious and be very careful with this. I also highly recommend reading up on the data storage service, on the API references on Roblox itself. That is a highly, highly recommended read for this. But apart from that, that's gonna be it for this lecture right here. I hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 45. (Roblox) Multiple Places in a Single Game: All right, welcome back to the intermediate section here for the robotics course. And in this lecture, we're going to be taking a look at how you can add multiple places to one experience. So for this, the general idea is that when we go back to our Creator dashboard over here, right, our creations, we have our example over here. Just as an example, we're just going to use this. We can go into this particular experience that this creation, and we can add different places. Now if we go to places, we can literally just add a new place over here. It's gonna give me a few places that I have previously already published. You can see some of them you can add because they are stored places and some of them you can add. So how do we basically go about this? Well, what you can do is inside of Roblox Studio. So if we go back over here, what we can do, e.g. is we're just going to get maybe a flat terrain, so it's gonna look a little bit different, so they don't have something a little bit different to play around with this as the grass one here in this case, you're going to say, well, okay, what are we gonna do with this? So we're gonna just going to save this. And what you can do is we can either make a new game, we can save this as a new game if I press Control S, or I can say update an existing game and I can go in here and I can say add as a new place them. So I'm gonna say this, I'm going to create. Now the name is going to be literally untitled game, but that's all fine because we can all change that in a little bit. That is nothing to worry about. So now we can go back to our dashboard if I actually reload this. See carpenters, please, number ten. Now of course that's not a good name. What we're gonna do is we're just going to click on the Edit in Studio button and it should then open Roblox Studio again. Now a theory, this should be a different instance than this. They should not actually collide. You can see now we're loading the place and this is the actual place, the RB experience or the RB creation, right? So now you can see it's called count minerals plays number ten. Now that is not quite the name that I had in mind. So we can go to game settings and you can see now we can under places actually change this as well. So you can see there's different player, players as well. And here we can configure the play. So let's say we also only 16, and this is going to be the grass is greener. There you go. And you can see there's a bunch of different things that you can do as well. We're just going to save this. And if we then save this, nothing changed, okay, that's fine. But we can then publish this and it's going to actually publish, right? So you can see we publish the changes, however, now, if we go back to the correlations over here to our example will be, if we reload this, you can see now the actual name is a grass is greener and we also change some of these things right here, right now. There's nothing happening in here right now, of course, because nothing is added here, but it is a different place inside of the same game. So as always, a thing to keep in mind read you can have multiple places inside of one gate. Next lecture, we'll see how you can tell apart between the two different places. Otherwise, I hope you've found this useful and you learn something new and I'll see you all in the next lecture. So, yeah. 46. (Roblox) Teleport between different Places: All right, welcome back to the intermediate section here for the robust course. And in this lecture we're gonna be seeing how we can teleport from one place to the other end is actually fairly straight forward by using the teleport service. So for this, what I'm going to do is I'm just going to copy my circle over here just so that we have something to basically go onto. And when you reach this circle, we're going to teleport to the place that we've basically added to our experience, to our RB here last time, this happened in the last lecture, this is gonna be the teleport circle and we're going to click the little plus over here adding a script. And the script is going to be the teleport script. And this is going to teleport us. For the teleportation, we need the teleport service. This is going to be equal to game colon get service. So this is of course the way that to get a service, and this is the teleport service. We also want to get the players, this is just gonna be game players. And then we want a teleporters. So the teleporters is the actual game object, right? They circle in this case. So this is gonna be the teller order and this is gonna be equal to script dot parent. And then we want the place ID. So this is the important thing, right? The place ID is a unique ID for your place. And you should be able to get this by going right here, right? So this is our place that we want to go to. And you can see, well, how do we get this? Well, just go into here. You can also change the name here, the description here are genres, all of that, and that's alright. However, we needed the place ID. How do we get this? Well, you can look at the URL over here and you can see this is the experience and this is the place. So this would be our place ID. We're just going to copy this and then we're gonna go back into roadblocks over here. And you will see that we can just make this a, we actually don't want to make this a string. We want to make this a number that's actually quite important. And then here we're just gonna make a local function both on part touch. So we're going to make a touch event over here in this case, other part and this is going to do, this is going to first of all get us to the character. This is just other part dot parent, that's our character. And then we're just going to say player is equal to the players colon, get player from character, passing in the character right here. And then if there is a player, What we're gonna do is we're going to say teleport service colon teleport. When a teleport to the place ID right here, you can see this is the place ID and we're going to teleport, of course, the player now players, but the singular player that has just touched this particular part. And we're going to say teleport or dot touched Poland and connect. And then we're just going to add the part touched without the parentheses. And that's gonna be the teleport script. So let's save that. And that is pretty much all that we need to do in this case. But if we now play, I should actually be spawning in stage two because that was the last time, well, the last thing that was saved, and you can see I am in stage two, so this is the cool thing about the saving rate. This actually saves while all of the different data even after multiple days. So that is the awesome thing now, of course I do have to defeat the level over here, but I think I'm gonna be fine over here. There you go. And an hour at stage five. And now when I touch this, I should get teleported. So let's see. So we're getting an error right here. That is totally fine because, and you can see teleport fail because you cannot teleport in Roblox Studio. That is the first very interesting thing to think about, but there's no issue about that because what we can do is we can just stop this and then we can just publish this to Roblox rates are going to publish this for now. All of our changes are published to Roblox. And if you now go back to our creations over here, we can go back to the experience, to the RB right here. And we're just going to say view on roadblocks. And the mode is going to play this right now, Roblox will open it. This is no longer Roblox Studio, but roadblocks. You will need to test it in Roblox as well. So this is a very important thing to keep a note of, right? If you have, the more complex your game is, basically, the more you will have to also do instead of roadblocks. And outside of Roblox Studio, I mean, of course it makes sense, right? You want to, you want to continuously test your game as well for any bugs and things like that. So what you can see, I'm still in stage five because, well, I'm still in stage five, that's really cool. And now if I go into here, boop, right, it's going to take a moment. And you can see grass is greener. Bam. It took a while. It takes sometimes a little while to load. But there we go. We are now on a different place. Now of course there's nothing in here, but this is just really awesome because this is the way that you can basically connect multiple different places. You can make multiple different levels or you can make multiple different instances. There's so many ways that you can basically use this, but you can make multiple Abby's that interconnect with each other. You can make I mean, there's tons of things that you can basically do with this by adding multiple different places. It's really cool. And that's basically the idea of a teleport to different places within your experience. Very cool. Indeed, that's gonna be it for this lecture right here. Hope you found this useful and you'll learn something new and I'll see you all in the next lecture. So, yeah. 47. (Roblox) Where to go from here: All right, welcome back to the intermediate section here, further Roblox course. And in this lecture, we're just going to talk about where to go next, as this is basically the last lecture here in this course. And the idea is that what, where do you wanna go next? So one particular thing that I just cannot recommend enough, and I've already talked about the Roblox Engine API references right here, which has all of the classes, right, as reference, you have all of the datatypes. Basically everything that you might want to have is in here. There are also some guides that can be really useful. This will basically help you build an even better foundation than you already have after going through all of the lectures before. Furthermore, of course, one big thing is that you will learn most by doing. So. This basically means that just keep trying out different things. Or I want to add this, I want to make it so that the player gets shot up into the sky. And then XYZ happens by taking continuous steps forward, you will be able to learn even more in the future. I also want to make an intermediate to advanced course. However, this is not yet available as soon as it is. You will be notified, of course, and props to you for sticking through this perseverance is the best thing that you can have when learning something like this. Because in the end, Roblox scripting and programming itself, it can be quite challenging and quite complicated, but you suck through it. So I'm very proud of you and I'm excited to see what roadblocks game you're going to come up with Apart from that, thank you so much for watching. Once again, if this was useful to you, I would very much appreciate a review from you. Otherwise, I'll hopefully see you in the next course. So yeah.