If anyone wants an example of how this can be used, review this code: local part = game.Workspace.Baseplate local function transformfunc (mat, trans) part.Material = mat part.Transparency = trans end transformfunc("Sand", 0.5 ) wait(10) transformfunc("LeafyGrass", 0) Its quite simple, the moment you start the game the baseplate will become sandy and half transparent, then after waiting 10 seconds the code will run the function again, except with different parameters. It can be a huge help when you want an item or value to go through different states after a certain requirement has been met. Parameters are used here simply to save time and simplify code.
This was short easy and simple great explanation yk, not only that, after finishing 10 tutorials, I’d recommend testing yourself by using all of them without any help, and note the ones that you struggle with and rewatch those vids. Getting practice in can help you remember those.
For those who don’t understand or still confused, parameters are like variables. Just think of them as variables, as in function(x, y). If you call function(1, 2), then x = 1 and y = 2. Since quite a decent amount of people see this, I’ll just add some more information, don’t read further if you’re easily confused. The variables that are passed into the parameters are actually copies. I’ll show you what I mean (and I haven’t touched Lua in a long time so I’ll be doing this with “pseudocode” mixed with C++): Let’s say we have a function called add that takes two integer variables… func int add(int x, int y) { return x + y; } And we have two variables called num1 and num2 outside, declared like so: int num1 = 0; int num2 = 1; Then passing that into the function - add(num1, num2) - should return 1 alright. Now let’s say we want to edit the parameters, adding 2x of each number (ex: x*2 + y*2). func int add(int x, int y) { x = x*2; y = y*2; return x + y; } So what do you think will happen if we run add(num1, num2) now? It should return 2 because 0*2 + 1*2 = 2. But here’s a question that comes up a lot with amateurs: are num1 and num2 multiplied too? No, the variables num1 and num2 are not changed AT ALL. This is because they’re passed in as parameters so int x and int y are simply variables that exist inside the function and the function only. Knowing some of you curious dedicated hardworking learners, you may ask, “Then how would I reference variables outside with my parameters?” Don’t worry, there’s a way. I’ll update this later because I’m on a phone. Alright here's the next part :) So in a language called C++, you can do so easily with something called "pass by reference". It works by defining the function as: function int changeNum(&num) Where the symbol & means "reference". However, this is (as far as I know) pretty much a C/C++ thing. We can work around it, however, in other languages like Lua. This requires a decent understanding of classes and objects. Just know that, classes are the templates to making objects, and they are basically "custom" data types programmers can write on their own. So we can have a "Person" class, with attributes like name and age (which has data types of String and int respectively), then we can mass produce people by making a ton of objects from that template. Weird analogy but I think it works (?). Moving on, primitive types are the basic building blocks of code. You've been using them already - int, double, boolean (true/false), char, etc. (Strings are objects btw because they are an array of char). What this basically means is that a String "references" where in the memory the first char is stored, and how many chars are after it, because we can only allocate so many data in a "block" (think binary 1s and 0s). We can't possibly have a whole chunk representing a string when they're just chars put together. If you see where I'm going with this, you're on track. Yes, we CANNOT pass by reference by doing function changeNum(num) because we're in Lua. But it's a different story if the parameter we're inputting is an object. Just make the primitive type into an object in any miraculous way possible. Store it in a table for example, idk lol. P/S: I haven't tested any of this second part but my guess should be right lmao you can test it on your own if it doesn't work uhh complain about it to me and I'll work on it. And some supporting evidence for my "shower thoughts": stackoverflow.com/questions/6128152/function-variable-scope-pass-by-value-or-reference
@@gabe1351 honestly just keep researching and practice writing the ones in tutorials and one day itll just click. What is it that you dont get about them?
@@gabe1351 you type "local ("here the name of your function") and then () the () are there for the parameters as you saw in the video after that you gonna type in your lines of codes and execute them with ("the name of your function") and then ()
Helllo, U Helped me Alot Im Nomrallly an Animator for stickman figures then i learned how to Animate on roblox But then i said to my self, "I cant ony animate cause i dont even know how to put it in a key or how to make moves and Justu, punching,Magic etc Im so happy, i learned alot from you and u desserve more subs!
Guys, if his explanation of parameters was confusing, I'll provide the explanation that worked for me. Basically, in his first example function, he writes: local function add(hotdog, ham) print (hotdog + ham) end Then the next line he types add(2, 3), and running the script puts 5 into the output. Basically, the function add() was defined as adding the two values in the parenthesis. In the first block of code, which acted like a definition of the function, the values are hotdog and ham. In the next line of code, which says print (hotdog + ham), it means that because hotdog and ham are in the parenthesis, it's gonna add the values hotdog and ham and print the result into the output. The function basically says, "If I have two values in my parenthesis, I will be adding those values and printing whatever I get after I added those values." So basically he used the parameters to help define what he wants his function to do and make it more useful in terms of what it can do. I like to think of parameters as parts of the definition of a function. Hopefully this was a helpful explanation.
alvin blox tought parameters while in his function video and i got so confused. but this is much better! plus alvin makes 20 min vids to explain and this is like 5
@@MrMr-oj7hl Best way to learn scripting is to do everything he does on the video whilst on RBX Studio, also once he does something key, try and copy what he just did but without looking at the video, until you remember it, so if you do that to everything, you will remember EVERYTHING.
great man, i watched your videos a long time ago but got caught up in some work so i forgot a lot, but its good to see that i had still subbed to your channel and now i can re learn it all! :)
For anyone that's confused, parameter is basically a function variable. E.g local function add(x,y) if I call this function by doing: add(num1, num2) it's basically saying: x = num1 y = num2 This is assuming you already have variables outside of the function named num1 and num2 It might sound redundant at first, but you can do a lot with it, you just don't know enough to implement it.
the more i watch these tutorials and the more devking uses functions and variables, the better i feel. This truly is a beginners tutorial, thank you devking
Example 1. (using return from the last video) function Addition(a,b) local c = a+b return c end print(Addition(5,8)) -- The computer sees that we assigned 5 and 8 inside A and B. -- From that you can just think of it as like a math equation 5+8 -- Then we return the c which is 13 since we calculated how much 5+8 is we get 13. -- So just think of the things inside the () the same as you'd do when doing a variable -- It's just the same as this local a = 5 local b = 8 local c = a+b print(c) Here is the copy paste for the script shown in the video. function add(Hotdog, Ham) print(Hotdog) end add("Sweet", 2)
@@sandpaper1711 I think they are used like this. Lets say you have a input field where players can enter their names. So you just get the information from the input and put it in a parameter. This is what I think it is used
Also they do help in the long run of coding since it's easier to just edit the part in the () than changing every single mention of them in the function individually
Somehow this is quite better than any guide i've seen, i'm already an amateur, i've coded a few simple games in roblox. yet this already started explaining in the most understandable ways thing i never understood even after 1 year of programming. sweet.
Here before 6969 subs, I love your tutorials. I always wanted to learn lua, but all tutorials SUCKED, but yours is actually helpful. I will make the best games I can with all this when I reach the end of these tutorials
I do recommend this tutorial to someone who's never learned a coding language before because if you already know a coding language you know like 80% of this course. It would be nice if there was a tutorial explaining their differences because the difference between most coding languages are small.
if any are still confused after reading all these comments, this is the basic example. at 1:42 he states that he can put a value in and then he does, and at 2:42 he should've said "you're probably wondering, how does 3 and 2 make 5 out of hotdog and ham?" its because it added them in order. this is what i was confused with, hope others find this helpful.
so if you guys came to it yet, parameters are just like substituting values in a math equation. you set the formula (or in this case, the parameters), and then u substitute the values to get the final answer. just a helpful guide if anyone found this confusing (pretty unlikely btw, he explained it great)
I have watched up to now and so far, you have been so extremely helpful! The only thing I wish you would do is use the scripts in a way you would normally use it instead of printing Hotdog.
@@practicalcucumber1395 maybe but for me its more confusing cuz i dont know how its supposed to be used it would make things less confising if he could like make a example with a script he normally uses this on so we know how its supposed/can be used
Okay if you don't know, here's the conclusion, hope you'll like it :). : Basically we're like making values like Hotdog, Ham in the video. then we call the function and add those two values together. Hotdog, Ham = 3,2 and the "strings" are like words even tho they're numbers like "3" "79" "Test" Integers are numbers.
Thank you TheDevKing, With all your videos till now, this is my Script : local function myFunction1() local MakeFunction = 76 print(MakeFunction*2) end myFunction1() local a = 5 local function myFunction2(e, s) local MyFavouriteNumber = 5 print (MyFavouriteNumber+a) end myFunction2(5, 19) local function ReturnCommand() print("This is my Whole script that I made") -- Script return("Wow, this is Advanced!") end local ReturnC = ReturnCommand() print (ReturnC)
Your videos are so easy to understand and you actually explain everything you do,than just write some code and dont explain anything about it.Ty TheDevKing for your videos,they are truly brilliant.
When you said functions might be getting a little boring now but I am actually enjoying learning how they work and how you give body to your function :) local function Me(Name, Year) print("My name is ", Name, ", it is the year ", Year, ".") end Me("Patt", 2021) I like to mess around and see what I can do with the functions, Hopefully I become a professional programmer in no time
After attempting to educate myself on LUA Scripting, and many fails I've finally found a way. You truly made it easier for me to figure out the basics for scripting and taking notes on the logic and all the possibilities was amazing and very useful. Bravo.
You are so underrated. You’re tutorials are amazing and you deserve more subscribers and viewers! You are so friendly and id much prefer to watch your tutorials than anyone else’s because you explain them so much easier and you’re very understanding. ❤️
Print(Hotdogs) basically tells the output section to say "Hotdogs" when you run the game, printing is mainly used to fix bugs, other than that it doesn't really have a use. Hope this helps!
You explain it the best but I just don't know what to use any of these stuff for Can I please have a reply and tell me what to use functions for and other stuff!
Wow I use functions so much now, I am also making a game. The game is a car game. Instead of using he car chassis tune, I made my own, thanks to thedevking I can makes games now.
local function car(firstpart, secondpart, thirdpart) print("car contains", firstpart, "and", secondpart, "and", thirdpart) end car("engine", "windows", "frame") an example :)
Because he calling "First "parameter with print its Hotdog .Look at top paramaters (hotdog"Firtstparameter",Ham"Second Parameter"). if he call print(ham) output will give 3x "2" because print calling "Second" parameter (sorry for my english)
parameters is just variables inside brackets and you can change their values anytime when you call (type the function) but its a bit specific in placement.
You make everything so easy to understand, I tried PeasFactory AlvinBlox and many other channels and this is the only one that actually makes me engaged and I learn from it. You explain it well and short. So you don’t waste time for 8 minutes you get straight into it and you actually explain extremely well. Thanks man.
You can also add variables when you define the parameter for example: local Number4 = 4 local function add(FirstNumber) print(FirstNumber + 2) end add(Number4)
If parameters are essentially variables, why not just define a variable (or local variable) for it? Why use parameters, that is what I am confused about.
I'm in an entry level college computer science course and all of this is stuff we've been learning. If you can learn this stuff when you're 11 you'll be way ahead of most people, keep it up!
I wish I had have learned this stuff when I was 11 lol. this is a hobby for me but I just finished my first year of college so I have lots of time to practice now
very happy to hear but just don't expect it to be useful and take it as an hobby or POTENTIALLY useful because I have seen a lot of kids do it...just helping ;)
for those who dont understand basically, lets say u type a parameter in the brackets ok? then u type print(name of parameter) u type both of the parameters. then u call the function at the end and then add the value u want inside the bracket. basically the parameters u first made dont have any value but after u call the function u add a value to the parameter and then it prints the value u gave to the parameter(s) to the output. hope this helped.
For ppl who are confused, basically parameters are like variables for example local function Stuff() In these () i want to find stuff. To save our time finding it using a function instead of using an variable to find it we use PARAMETERS so, to write an parameter we put the thing we want to find inside of the functions () and now the code would be local function stuff(stuff) Now, since we found it, I can use the parameter how much I want to use it (for me) now I would (for me) I would return "stuff" if successful. for example local function stuff(stuff) return true print(" returned"..tostring(stuff)) And as you see, I use stuff again cuz I was looking for stuff using an function. And yeah! Hope you understand.. and if you don't understand to tostring method.. I will create an video about tostring
What I learned for Parameters: local function bruh(No, Yes) Print(No) end bruh(Lol, Yes) When runned, it should print "Lol" in the output You can do the same with numbers: local function add(12, 31) print(12) end add(25, 90) When runned, it should print "25" in output.
@@malt_y7280 Just try think of it a changing Variable eg. function Help(69,420) print(69) end Help(21,9999) should print 21 cuz we want to print 69 but we decided wanted to change it
for those who are confused an easier way to do this is by doing local hotdog = 3 local ham = 2 now you've set the values into these variables/parameter's as you can see this is a bit easier and you don't have to do add(3,2) -- this is a bit confusing now you can do print(3,2) for those who are still having a problem this is how you do it function add(hotdog, ham) local hotdog = 3 -- btw this is what they mean by saying parameters' are just like variables because they are local ham = 2 -- telling the function what to do print(hotdog + ham) end) now do -- add() -- as you can see this is a bit easier then doing add(3,2)
If you guys still don't understand parameters, go watch alvin blox's tutorial about it on episode 3 on his beginner scripting tutorial guide on the timestamp: 5:02 as it is quite helpful.
In the parameter it says Hotdog, Ham but he only printed Hotdog in the function which when he called the function the parameter only recognized the Hotdog which equals Sweet. This is probably a bad explanation so you have any questions just ask.
You cannot print 2 with the string for example you cannot print sauce with a number after and that’s why he only put print hotdog if you look closely if he put hotdog + ham it would cause an error hope this was helpful
This is what I think parameters are: Parameters are variables that can only be used by functions. Parameters are also a place holder. - Example ⬇ 1 - local function add(HotDog) 2 - print(HotDog) 3 - end 4 - add("Sweet") ----> it's gonna print Sweet because HotDog is like a place holder in this case it's for a Sweet, so if you type 1 - local function add(HotDog) 2 - print(HotDog) 3 - end 4 - add("Sweet") it will print Sweet This is only my thinking on what parameters are so if people who know what they are can they comment to help me? Thank you
For people who dont understand the parameters. Say you have a box, and in the front of the box you can insert two numbers to add together: local function add(Number1, Number2) print (Number1+Number2)
if youre wondering how it was able to print the function even though the print was AFTER calling the function, its because the print is part of the function. the function IS printing, so when you call the function, youre just printing it. (i was pretty confused on this for a while so i hope this helps anyone else)
im getting back into roblox scripting i already know a decent amount of lua so im skimming through some of your videos to refresh my memory while getting ready for topics like events raycasting and who knows what because i sure as hell dont
In this case, hotdog was the variable that was holding the value "sweet" and the 2 next to sweet was used to give the variable hamburgers a value. So hotdog = "sweet" and hamburgers = 2
I like you more than alvinblox, i often have to replay alvinblox's coding videos multiple times to even know what he's talkin about. But i just have to watch your vids once and i know how stuff works.
Hey guys! Be sure to join the discord server if you have any questions or if you would like to meet me! discord.gg/FKcSyRh
Why there no replys?
@Builderman cool
The invite do be expired
Yeah
Im so confused tbh WHY in the world is this whole output thing even neccesary
If anyone wants an example of how this can be used, review this code:
local part = game.Workspace.Baseplate
local function transformfunc (mat, trans)
part.Material = mat
part.Transparency = trans
end
transformfunc("Sand", 0.5 )
wait(10)
transformfunc("LeafyGrass", 0)
Its quite simple, the moment you start the game the baseplate will become sandy and half transparent, then after waiting 10 seconds the code will run the function again, except with different parameters. It can be a huge help when you want an item or value to go through different states after a certain requirement has been met. Parameters are used here simply to save time and simplify code.
good example thx
great example
OOOH i get it now. Thanks!
Thank you so bro, you helped me understand parameters on a whole another level. Thanks!
This was short easy and simple great explanation yk, not only that, after finishing 10 tutorials, I’d recommend testing yourself by using all of them without any help, and note the ones that you struggle with and rewatch those vids. Getting practice in can help you remember those.
Holy. Thank you sir, you're the only individual who has explained parameters in a way so that I could understand them.
Was just gonna comment this.
Watch peasfactory
@@tentix9022 thx man 😄
@@MarioMario-yb3iz lol no probs
Neoory doesn’t matter how long it is as long as it helps
For those who don’t understand or still confused, parameters are like variables. Just think of them as variables, as in function(x, y). If you call function(1, 2), then x = 1 and y = 2.
Since quite a decent amount of people see this, I’ll just add some more information, don’t read further if you’re easily confused. The variables that are passed into the parameters are actually copies. I’ll show you what I mean (and I haven’t touched Lua in a long time so I’ll be doing this with “pseudocode” mixed with C++):
Let’s say we have a function called add that takes two integer variables…
func int add(int x, int y) {
return x + y;
}
And we have two variables called num1 and num2 outside, declared like so:
int num1 = 0;
int num2 = 1;
Then passing that into the function - add(num1, num2) - should return 1 alright.
Now let’s say we want to edit the parameters, adding 2x of each number (ex: x*2 + y*2).
func int add(int x, int y) {
x = x*2;
y = y*2;
return x + y;
}
So what do you think will happen if we run add(num1, num2) now? It should return 2 because 0*2 + 1*2 = 2. But here’s a question that comes up a lot with amateurs: are num1 and num2 multiplied too? No, the variables num1 and num2 are not changed AT ALL. This is because they’re passed in as parameters so int x and int y are simply variables that exist inside the function and the function only. Knowing some of you curious dedicated hardworking learners, you may ask, “Then how would I reference variables outside with my parameters?”
Don’t worry, there’s a way. I’ll update this later because I’m on a phone.
Alright here's the next part :)
So in a language called C++, you can do so easily with something called "pass by reference". It works by defining the function as:
function int changeNum(&num)
Where the symbol & means "reference". However, this is (as far as I know) pretty much a C/C++ thing. We can work around it, however, in other languages like Lua. This requires a decent understanding of classes and objects. Just know that, classes are the templates to making objects, and they are basically "custom" data types programmers can write on their own. So we can have a "Person" class, with attributes like name and age (which has data types of String and int respectively), then we can mass produce people by making a ton of objects from that template. Weird analogy but I think it works (?). Moving on, primitive types are the basic building blocks of code. You've been using them already - int, double, boolean (true/false), char, etc. (Strings are objects btw because they are an array of char). What this basically means is that a String "references" where in the memory the first char is stored, and how many chars are after it, because we can only allocate so many data in a "block" (think binary 1s and 0s). We can't possibly have a whole chunk representing a string when they're just chars put together. If you see where I'm going with this, you're on track.
Yes, we CANNOT pass by reference by doing function changeNum(num) because we're in Lua. But it's a different story if the parameter we're inputting is an object. Just make the primitive type into an object in any miraculous way possible. Store it in a table for example, idk lol.
P/S: I haven't tested any of this second part but my guess should be right lmao you can test it on your own if it doesn't work uhh complain about it to me and I'll work on it.
And some supporting evidence for my "shower thoughts": stackoverflow.com/questions/6128152/function-variable-scope-pass-by-value-or-reference
aye i appreciate your help
thank you OH MY GOSH
i understand it now but what would be the point of them if u could just print x,y or whatever u put
@@josh-ug3qw I don't know but it'll probably be more useful later on
mate thanks for that
I am so confused
But I’m never giving up! I will watch this series over and over if I have tooo!
same, i think this is my 3rd time rewatching the beginners series
What are you confused about? These are pretty simple for the most part. I cam answer your question about this. If you still have questions.
@@NewsOnQueue I don't understand how to do functions
@@gabe1351 honestly just keep researching and practice writing the ones in tutorials and one day itll just click. What is it that you dont get about them?
@@gabe1351 you type "local ("here the name of your function") and then ()
the () are there for the parameters as you saw in the video
after that you gonna type in your lines of codes and execute them with ("the name of your function") and then ()
what is with this man and hotdogs
hotdogs r cool
Let's just say that he is always hungry and he loves eating hotdogs...
ik i was gonna comment that lol
He is spending 1000$/month on hotdogs.
Plot twist his side job is a hotdog stand
Helllo, U Helped me Alot Im Nomrallly an Animator for stickman figures then i learned how to Animate on roblox But then i said to my self, "I cant ony animate cause i dont even know how to put it in a key or how to make moves and Justu, punching,Magic etc Im so happy, i learned alot from you and u desserve more subs!
Thanks man :)
@@TheDevKing hi devking
@@TheDevKing hey Dev King can I add you on roblox?
@@TheDevKingI don’t understand the function part in part 5,6,7 I just wanted to tell u it is ok if u ignore me :(
Guys, if his explanation of parameters was confusing, I'll provide the explanation that worked for me.
Basically, in his first example function, he writes:
local function add(hotdog, ham)
print (hotdog + ham)
end
Then the next line he types add(2, 3), and running the script puts 5 into the output.
Basically, the function add() was defined as adding the two values in the parenthesis. In the first block of code, which acted like a definition of the function, the values are hotdog and ham. In the next line of code, which says print (hotdog + ham), it means that because hotdog and ham are in the parenthesis, it's gonna add the values hotdog and ham and print the result into the output. The function basically says, "If I have two values in my parenthesis, I will be adding those values and printing whatever I get after I added those values."
So basically he used the parameters to help define what he wants his function to do and make it more useful in terms of what it can do. I like to think of parameters as parts of the definition of a function.
Hopefully this was a helpful explanation.
Nice! Very simple and helpful. Thank you, man.
Thank you this made me understand it better
Tysm
@@theroomateisamuffin9524 K-K-K-K-KAKYOIN!
@@IX_4 everytime i comment someone says that lmao, you have a nice short name btw
Hotdogs are the student that always gets picked, if he calls in sick the teacher will just call him on the phone.
What
@@valeriyaaslanov3254 ok
I GET IT LOL
TheDevKing: i need a name
hotdog: :I
TheDevKing: ok, i'll use you
Even a 8 year old could become a scripter after watching this. I should know(:
@@blinkxero6756 are you saying you're an 8 year old?
No I'm not
@@imdurpy4145 i am around that age LOL
i am learning script
@@sushi7910 did you learn it yet
others tutorials: 20 minutes
TheDevKing tutorials: 5 minutes
thx god!
lol
Not even 5 min there like 3 minutes
Other channels usually explain everything and try to miss nothing.
@EpicGreenYoda true
alvin blox tought parameters while in his function video and i got so confused. but this is much better! plus alvin makes 20 min vids to explain and this is like 5
hi i am litterilly watching this hole series all night he sun is just coming up
@@MrMr-oj7hl Best way to learn scripting is to do everything he does on the video whilst on RBX Studio, also once he does something key, try and copy what he just did but without looking at the video, until you remember it, so if you do that to everything, you will remember EVERYTHING.
@@MrMr-oj7hl Your welcome :)
Tysm for the tip
@@ClassyGamesTMtysm for the tip
here before 7,000,000,000 subscribers! dude your the best
lol
To be honest I think it should be 7.7 billion though
To be honest I think it should be 6.9 bilion though
@@pranavmoolan8524 lol true
this comment was a year ago and you still replied just now lol
great man, i watched your videos a long time ago but got caught up in some work so i forgot a lot, but its good to see that i had still subbed to your channel and now i can re learn it all! :)
For anyone that's confused, parameter is basically a function variable.
E.g local function add(x,y)
if I call this function by doing:
add(num1, num2)
it's basically saying:
x = num1
y = num2
This is assuming you already have variables outside of the function named num1 and num2
It might sound redundant at first, but you can do a lot with it, you just don't know enough to implement it.
@PubxKitty911 for this you dont have to add " on Sweet unless it is used at the bottom called argument
THANK YOU SO MUCH I UNDERSTAND NOW!!!! Many hugs and *hotdogs* for you 😊
Throughout the whole series I noticed something
DevKing likes hot dogs
this series of 4-12 minutes long videos have been more useful than a complete 48 minute long video
ty so much(sorry for bad english)
the more i watch these tutorials and the more devking uses functions and variables, the better i feel. This truly is a beginners tutorial, thank you devking
Example 1. (using return from the last video)
function Addition(a,b)
local c = a+b
return c
end
print(Addition(5,8))
-- The computer sees that we assigned 5 and 8 inside A and B.
-- From that you can just think of it as like a math equation 5+8
-- Then we return the c which is 13 since we calculated how much 5+8 is we get 13.
-- So just think of the things inside the () the same as you'd do when doing a variable
-- It's just the same as this
local a = 5
local b = 8
local c = a+b
print(c)
Here is the copy paste for the script shown in the video.
function add(Hotdog, Ham)
print(Hotdog)
end
add("Sweet", 2)
so is there really any purpose to them? Do they like, make your game less laggy or something?
@@sandpaper1711 I think they are used like this. Lets say you have a input field where players can enter their names. So you just get the information from the input and put it in a parameter. This is what I think it is used
Also they do help in the long run of coding since it's easier to just edit the part in the () than changing every single mention of them in the function individually
Somehow this is quite better than any guide i've seen, i'm already an amateur, i've coded a few simple games in roblox. yet this already started explaining in the most understandable ways thing i never understood even after 1 year of programming. sweet.
i jsut going through taking notes as i go, usually one page per video but im trying my bestg
Here before 6969 subs, I love your tutorials. I always wanted to learn lua, but all tutorials SUCKED, but yours is actually helpful. I will make the best games I can with all this when I reach the end of these tutorials
Omggg 69 FUNNInnumMABERRR RR R R R
I do recommend this tutorial to someone who's never learned a coding language before because if you already know a coding language you know like 80% of this course. It would be nice if there was a tutorial explaining their differences because the difference between most coding languages are small.
if any are still confused after reading all these comments, this is the basic example. at 1:42 he states that he can put a value in and then he does, and at 2:42 he should've said "you're probably wondering, how does 3 and 2 make 5 out of hotdog and ham?" its because it added them in order. this is what i was confused with, hope others find this helpful.
so if you guys came to it yet, parameters are just like substituting values in a math equation. you set the formula (or in this case, the parameters), and then u substitute the values to get the final answer. just a helpful guide if anyone found this confusing (pretty unlikely btw, he explained it great)
I have watched up to now and so far, you have been so extremely helpful! The only thing I wish you would do is use the scripts in a way you would normally use it instead of printing Hotdog.
that would make it confusing for people who get lost easily. It's a lot more to take in instead of just the topic of the video.
@@practicalcucumber1395 maybe but for me its more confusing cuz i dont know how its supposed to be used it would make things less confising if he could like make a example with a script he normally uses this on so we know how its supposed/can be used
@@justarandomguywholovesanim726 for real
he's trying to express his likings for hotdogs
this guy exists yet people still dont know how to script this guy is a GIFT
Alternate title: print but more complex
nope
@@HiBye-rq2mr 17h ago ok
more like local but more complex
fucking asked?
no its not print but more complex sorry if im being rude im not trying to be
Okay if you don't know, here's the conclusion, hope you'll like it :). :
Basically we're like making values like Hotdog, Ham in the video. then we call the function and add those two values together.
Hotdog, Ham = 3,2 and the "strings" are like words even tho they're numbers like "3" "79" "Test" Integers are numbers.
Example:
local function multiply(arg1, arg2)
return arg1*arg2
end
local Variable = multiply(6, 2)
print(Variable)
it will print 12 because 6x2=12
This comment made me understand the video, thanks man
I was understanding the video but now I see your comment and it just ruined everything
Can u. Make it simpler
Thank you TheDevKing, With all your videos till now, this is my Script :
local function myFunction1()
local MakeFunction = 76
print(MakeFunction*2)
end
myFunction1()
local a = 5
local function myFunction2(e, s)
local MyFavouriteNumber = 5
print (MyFavouriteNumber+a)
end
myFunction2(5, 19)
local function ReturnCommand()
print("This is my Whole script that I made")
-- Script
return("Wow, this is Advanced!")
end
local ReturnC = ReturnCommand()
print (ReturnC)
Your videos are so easy to understand and you actually explain everything you do,than just write some code and dont explain anything about it.Ty TheDevKing for your videos,they are truly brilliant.
i've been scripting for 1 year and i never learned i just watched others and im really starting to grasp this
When you said functions might be getting a little boring now but I am actually enjoying learning how they work and how you give body to your function :)
local function Me(Name, Year)
print("My name is ", Name, ", it is the year ", Year, ".")
end
Me("Patt", 2021)
I like to mess around and see what I can do with the functions, Hopefully I become a professional programmer in no time
Same lol
Bro, I watched TONS of tutorials and none of them made me understand but u did. I will sub to you
local function amongus(imposter, crewmate)
print(imposter+crewmate)
end
amongus(10,1)
My school : takes 2 years to get to function
TheDevKing : your wish have came true
After attempting to educate myself on LUA Scripting, and many fails I've finally found a way. You truly made it easier for me to figure out the basics for scripting and taking notes on the logic and all the possibilities was amazing and very useful. Bravo.
You are so underrated. You’re tutorials are amazing and you deserve more subscribers and viewers! You are so friendly and id much prefer to watch your tutorials than anyone else’s because you explain them so much easier and you’re very understanding. ❤️
Lerua f
Lerua whoops
I am learning so much! I could not thank you enough! :D
omg brooo for the last few months i had a problem with understating parameters and arguments, now i finally got it!! thank you so much
This guy really love hotdogs... xD
i swear this dude will unknowingly teach someone that will become a popular roblox dev in the future
probably what happened with the creator of get a snack at 4 am. she mentioned thedevking in the credits page for his tutorials
local function add(Number1, Number2, Text)
print(Number1+Number2..Text)
end
add(1,3," yas")
The Most Helpful Person I Ever Watched, Continue Bro
Hello! I know I am late since this video is 4 years ago but, may i ask what print(Hotdogs) does in the code?
Print(Hotdogs) tells the script to say "Hotdogs" in the output, the output is that thing on the bottom where all the numbers and letters are printed.
@@Gorillix2024 and hotdogs = 3,2 so it prints 5
Print(Hotdogs) basically tells the output section to say "Hotdogs" when you run the game, printing is mainly used to fix bugs, other than that it doesn't really have a use. Hope this helps!
bro u deserve way more views ur tutorials are great
You explain it the best but I just don't know what to use any of these stuff for
Can I please have a reply and tell me what to use functions for and other stuff!
Wow I use functions so much now, I am also making a game. The game is a car game. Instead of using he car chassis tune, I made my own, thanks to thedevking I can makes games now.
Your tutorials are so simple and I love your jokes
If I were to pick any TH-cam tutorial i would choose yours :D
Are you hungry watching these? 😂
Thank you so much tho!
local function car(firstpart, secondpart, thirdpart)
print("car contains", firstpart, "and", secondpart, "and", thirdpart)
end
car("engine", "windows", "frame")
an example :)
But couldn't I just add a variable. Why is there no "2" when called with a string?
Because he calling "First "parameter with print its Hotdog .Look at top paramaters (hotdog"Firtstparameter",Ham"Second Parameter"). if he call print(ham) output will give 3x "2" because print calling "Second" parameter (sorry for my english)
@@EB-db1us Oh that's makes more sense.
parameters is just variables inside brackets and you can change their values anytime when you call (type the function) but its a bit specific in placement.
You make everything so easy to understand, I tried PeasFactory AlvinBlox and many other channels and this is the only one that actually makes me engaged and I learn from it. You explain it well and short. So you don’t waste time for 8 minutes you get straight into it and you actually explain extremely well. Thanks man.
You can also add variables when you define the parameter for example:
local Number4 = 4
local function add(FirstNumber)
print(FirstNumber + 2)
end
add(Number4)
If parameters are essentially variables, why not just define a variable (or local variable) for it? Why use parameters, that is what I am confused about.
Watch alvin bloxx his tutorial also explains about parameters check it out.
Damn, this is probably the only concept outside of printing that I learned without having to practice after, thank you!
i'm eleven and im trying to learn as more as i can so it can help in future btw i want to be a game dev.
I'm in an entry level college computer science course and all of this is stuff we've been learning. If you can learn this stuff when you're 11 you'll be way ahead of most people, keep it up!
I wish I had have learned this stuff when I was 11 lol. this is a hobby for me but I just finished my first year of college so I have lots of time to practice now
very happy to hear but just don't expect it to be useful and take it as an hobby or POTENTIALLY useful because I have seen a lot of kids do it...just helping ;)
@@TeamTrapMike Yeah he's right all of this will forever be needed in order to get into the complicated stuff.
@Mike C I’m actually 10 and almost in the advanced series. (:
for those who dont understand basically, lets say u type a parameter in the brackets ok? then u type print(name of parameter) u type both of the parameters. then u call the function at the end and then add the value u want inside the bracket. basically the parameters u first made dont have any value but after u call the function u add a value to the parameter and then it prints the value u gave to the parameter(s) to the output. hope this helped.
For ppl who are confused, basically parameters are like variables for example local function Stuff() In these () i want to find stuff. To save our time finding it using a function instead of using an variable to find it we use PARAMETERS so, to write an parameter we put the thing we want to find inside of the functions () and now the code would be local function stuff(stuff) Now, since we found it, I can use the parameter how much I want to use it (for me) now I would (for me) I would return "stuff" if successful. for example local function stuff(stuff) return true print(" returned"..tostring(stuff)) And as you see, I use stuff again cuz I was looking for stuff using an function. And yeah! Hope you understand.. and if you don't understand to tostring method.. I will create an video about tostring
thanks man this really helped a lot
Protect this man at all cost!!!!
bot?
For some reason I think returning is the easiest.
Same.
Wow easy understanding
Every one should teach like you
What I learned for Parameters:
local function bruh(No, Yes)
Print(No)
end
bruh(Lol, Yes)
When runned, it should print "Lol" in the output
You can do the same with numbers:
local function add(12, 31)
print(12)
end
add(25, 90)
When runned, it should print "25" in output.
This if true actually helped me understand it a lot better thank you tons mate
@@malt_y7280 Just try think of it a changing Variable eg.
function Help(69,420)
print(69)
end
Help(21,9999)
should print 21 cuz we want to print 69 but we decided wanted to change it
@@mrnormalrobloxian5060 i know this is 2 years ago but i love you for this comment
local function ThankYou(TheDevKing)
print(TheDevKing)
end
ThankYou("Thanks for these amazing tutorials!")
I watched the vid without sound and with subtitles and when he says 'the dev king' the subtitles say 'the deaf king" LOL nice vids BTW
TheDevKing: **tries to think of an example for variables**
TheDevKing: h o t d o g
Alvinblox: hamburger
Devking: hotdog
for those who are confused an easier way to do this is by doing
local hotdog = 3
local ham = 2
now you've set the values into these variables/parameter's as you can see this is a bit easier
and you don't have to do add(3,2) -- this is a bit confusing
now you can do print(3,2) for those who are still having a problem this is how you do it
function add(hotdog, ham)
local hotdog = 3 -- btw this is what they mean by saying parameters' are just like variables because they are
local ham = 2
-- telling the function what to do
print(hotdog + ham)
end)
now do --
add() -- as you can see this is a bit easier then doing add(3,2)
I never thought I would enjoy learning
What can we use these scripts for? I’m trying to make a anime game and this isn’t helping very much
If you guys still don't understand parameters, go watch alvin blox's tutorial about it on episode 3 on his beginner scripting tutorial guide on the timestamp: 5:02 as it is quite helpful.
His tutorials are so good that I instantly understood what parameters are at 1:30
Ok i might be to late but at 4:29 when he is wrtiing sweet cool awesome and others why doesnt it print 2?
In the parameter it says Hotdog, Ham but he only printed Hotdog in the function which when he called the function the parameter only recognized the Hotdog which equals Sweet. This is probably a bad explanation so you have any questions just ask.
Ham is 2, but it si not printed because he did not print ham, he printed hotdog
You cannot print 2 with the string for example you cannot print sauce with a number after and that’s why he only put print hotdog if you look closely if he put hotdog + ham it would cause an error hope this was helpful
He seems so sweet and optimistic and i LOVE IT he also tends to put hotdog in the scripts a lot lmao.
You can also return the sum of the two numbers by adding local sum before the equation. (Delete the print part if you do this)
This is what I think parameters are:
Parameters are variables that can only be used by functions.
Parameters are also a place holder. - Example ⬇
1 - local function add(HotDog)
2 - print(HotDog)
3 - end
4 - add("Sweet") ----> it's gonna print Sweet because HotDog is like a place holder in this case it's for a Sweet, so if you type 1 - local function add(HotDog)
2 - print(HotDog)
3 - end
4 - add("Sweet") it will print Sweet
This is only my thinking on what parameters are so if people who know what they are can they comment to help me?
Thank you
Thank you
@@imrantube747 no problem
what does the , 2 mean?
The way you explain is so easy! I have liked and subbed with notifications on!
God give this man some hotdogs...
For people who dont understand the parameters. Say you have a box, and in the front of the box you can insert two numbers to add together:
local function add(Number1, Number2)
print (Number1+Number2)
wait can you make it so like it is 3? like local function add(Number1,Number2,Number3) ??
@@GarNomadT yup
@@Aizu_YT oh okay thanks
some other youtubers take 30 minutes to explain something
this man takes 5 minutes to explain the same thing and 10x easier
You're my best teacher!
Manifesting that your tutorials will help me make a successful game from scratch
if youre wondering how it was able to print the function even though the print was AFTER calling the function, its because the print is part of the function. the function IS printing, so when you call the function, youre just printing it. (i was pretty confused on this for a while so i hope this helps anyone else)
You sure does love hotdogs xD btw nice tutorials i'm learning so much
:O!
Hotdog is evolving! Hotdog involved into.. a... HotHamDog?
2:27
I am not sure I will ever know how hard it is to learn parameters without DevKing. I learned from your video and it was SO easy to understand
Still useful to this day!!
as a person who doesn't know scripting, i can confirm that i understand everything from this guy, other can't explain as simple as this guy
No way the king will respond after 4 years
so true
im getting back into roblox scripting i already know a decent amount of lua so im skimming through some of your videos to refresh my memory while getting ready for topics like events raycasting and who knows what because i sure as hell dont
It’s like my 5th time watching it but I finally get it!
This this, is amazing I have learned so much after watching your other tutorials.
this man and his hotdogs teach me a lot.
bro istg i was so confused what parameters are and this just made it so clear
My man mentioning his bros Hotdog and Hamburger in each episode👍
Pure dedication to his homies👌
İngilizcem az ben bile anladım güzel video
I think he was hungry when he was making this and he cant stop thinking about food.
In this case, hotdog was the variable that was holding the value "sweet" and the 2 next to sweet was used to give the variable hamburgers a value. So hotdog = "sweet" and hamburgers = 2
thank you
I like you more than alvinblox, i often have to replay alvinblox's coding videos multiple times to even know what he's talkin about. But i just have to watch your vids once and i know how stuff works.
I learn Roblox scripting from this guy faster than from Roblox's Forum itself. It's insane
ive learned so much from this series on my first couple videos
here before 50k thx dude u helped me so much