Beginner's Roblox Scripting Tutorial #7 - Parameters (Beginner to Pro 2019)

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 1,3 тис.

  • @TheDevKing
    @TheDevKing  5 років тому +159

    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

  • @TofuTuesdays
    @TofuTuesdays Рік тому +409

    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.

    • @unsolved1376
      @unsolved1376 Рік тому +12

      good example thx

    • @lonelylilpp
      @lonelylilpp Рік тому +6

      great example

    • @NotSoGreatPerson841
      @NotSoGreatPerson841 Рік тому +9

      OOOH i get it now. Thanks!

    • @hunaidkiani6100
      @hunaidkiani6100 Рік тому +4

      Thank you so bro, you helped me understand parameters on a whole another level. Thanks!

    • @Azure546
      @Azure546 Рік тому +8

      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.

  • @enlasted5320
    @enlasted5320 6 років тому +301

    Holy. Thank you sir, you're the only individual who has explained parameters in a way so that I could understand them.

    • @oldscratch6861
      @oldscratch6861 5 років тому +4

      Was just gonna comment this.

    • @tentix9022
      @tentix9022 4 роки тому +5

      Watch peasfactory

    • @MarioMario-yb3iz
      @MarioMario-yb3iz 4 роки тому +2

      @@tentix9022 thx man 😄

    • @tentix9022
      @tentix9022 4 роки тому +1

      @@MarioMario-yb3iz lol no probs

    • @bepski
      @bepski 4 роки тому +2

      Neoory doesn’t matter how long it is as long as it helps

  • @zKenaboss
    @zKenaboss 4 роки тому +1212

    what is with this man and hotdogs

    • @petars5914
      @petars5914 4 роки тому +72

      hotdogs r cool

    • @akshitagoel6762
      @akshitagoel6762 4 роки тому +69

      Let's just say that he is always hungry and he loves eating hotdogs...

    • @sylvanusdzotsi2234
      @sylvanusdzotsi2234 4 роки тому +7

      ik i was gonna comment that lol

    • @itseasy4us256
      @itseasy4us256 4 роки тому +19

      He is spending 1000$/month on hotdogs.

    • @kryptcx
      @kryptcx 4 роки тому +24

      Plot twist his side job is a hotdog stand

  • @normalhuman1501
    @normalhuman1501 4 роки тому +60

    Hotdogs are the student that always gets picked, if he calls in sick the teacher will just call him on the phone.

  • @emmettnredblue1857
    @emmettnredblue1857 5 років тому +567

    I am so confused
    But I’m never giving up! I will watch this series over and over if I have tooo!

    • @ayanokouji5784
      @ayanokouji5784 5 років тому +68

      same, i think this is my 3rd time rewatching the beginners series

    • @NewsOnQueue
      @NewsOnQueue 4 роки тому +18

      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.

    • @gabe1351
      @gabe1351 4 роки тому +11

      @@NewsOnQueue I don't understand how to do functions

    • @NewsOnQueue
      @NewsOnQueue 4 роки тому +17

      @@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?

    • @ddso4365
      @ddso4365 4 роки тому +16

      @@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 ()

  • @EnderghostLD
    @EnderghostLD 4 роки тому +120

    TheDevKing: i need a name
    hotdog: :I
    TheDevKing: ok, i'll use you

    • @blinkxero6756
      @blinkxero6756 4 роки тому

      Even a 8 year old could become a scripter after watching this. I should know(:

    • @imdurpy4145
      @imdurpy4145 4 роки тому

      @@blinkxero6756 are you saying you're an 8 year old?

    • @blinkxero6756
      @blinkxero6756 4 роки тому +1

      No I'm not

    • @sushi7910
      @sushi7910 4 роки тому

      @@imdurpy4145 i am around that age LOL
      i am learning script

    • @Zenith_Nulls
      @Zenith_Nulls 3 роки тому

      @@sushi7910 did you learn it yet

  • @GDcelta
    @GDcelta 4 роки тому +540

    others tutorials: 20 minutes
    TheDevKing tutorials: 5 minutes
    thx god!

    • @failuretocomply3
      @failuretocomply3 4 роки тому +2

      lol

    • @chrismelon8192
      @chrismelon8192 4 роки тому +4

      Not even 5 min there like 3 minutes

    • @Assassinbunny
      @Assassinbunny 4 роки тому +8

      Other channels usually explain everything and try to miss nothing.

    • @Assassinbunny
      @Assassinbunny 4 роки тому

      @EpicGreenYoda true

    • @pranjalpadmakar5489
      @pranjalpadmakar5489 4 роки тому +4

      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

  • @kemonogane
    @kemonogane 5 років тому +65

    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!

    • @TheDevKing
      @TheDevKing  5 років тому +14

      Thanks man :)

    • @jaydentt72
      @jaydentt72 4 роки тому

      @@TheDevKing hi devking

    • @kevinduliesco5468
      @kevinduliesco5468 4 роки тому

      @@TheDevKing hey Dev King can I add you on roblox?

    • @GoldenAyushRoblox
      @GoldenAyushRoblox 11 місяців тому

      @@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 :(

  • @Lycoriste
    @Lycoriste 3 роки тому +260

    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

    • @ayo2740
      @ayo2740 3 роки тому +2

      aye i appreciate your help

    • @Poopifylovescod
      @Poopifylovescod 2 роки тому +3

      thank you OH MY GOSH

    • @josh-ug3qw
      @josh-ug3qw 2 роки тому +3

      i understand it now but what would be the point of them if u could just print x,y or whatever u put

    • @Ghazi_Al_Tamimi
      @Ghazi_Al_Tamimi 2 роки тому +4

      @@josh-ug3qw I don't know but it'll probably be more useful later on

    • @benryt
      @benryt 2 роки тому

      mate thanks for that

  • @tepara_skates591
    @tepara_skates591 4 роки тому +32

    hi i am litterilly watching this hole series all night he sun is just coming up

    • @ClassyGamesTM
      @ClassyGamesTM 3 роки тому +8

      @@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.

    • @ClassyGamesTM
      @ClassyGamesTM 3 роки тому +2

      @@MrMr-oj7hl Your welcome :)

    • @BL4ZE483
      @BL4ZE483 2 місяці тому

      Tysm for the tip

    • @BL4ZE483
      @BL4ZE483 2 місяці тому

      ​@@ClassyGamesTMtysm for the tip

  • @fluffypanda6024
    @fluffypanda6024 3 роки тому +22

    Throughout the whole series I noticed something
    DevKing likes hot dogs

  • @overk1lls755
    @overk1lls755 5 років тому +15

    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! :)

  • @thyst7014
    @thyst7014 5 років тому +88

    here before 7,000,000,000 subscribers! dude your the best

    • @TheDevKing
      @TheDevKing  5 років тому +16

      lol

    • @zeptitan6037
      @zeptitan6037 5 років тому +6

      To be honest I think it should be 7.7 billion though

    • @pranavmoolan8524
      @pranavmoolan8524 4 роки тому +7

      To be honest I think it should be 6.9 bilion though

    • @thyst7014
      @thyst7014 4 роки тому +1

      @@pranavmoolan8524 lol true

    • @AdrianKlep
      @AdrianKlep 4 роки тому +1

      this comment was a year ago and you still replied just now lol

  • @idarky4753
    @idarky4753 4 роки тому +145

    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.

  • @roatninthethird
    @roatninthethird 2 роки тому +6

    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

  • @lacasadepapel4356
    @lacasadepapel4356 5 років тому +13

    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

    • @Fluffernater
      @Fluffernater 4 роки тому +1

      Omggg 69 FUNNInnumMABERRR RR R R R

  • @iideathlymusic3708
    @iideathlymusic3708 4 роки тому +8

    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. ❤️

  • @ilzrogacha3638
    @ilzrogacha3638 4 роки тому +71

    Alternate title: print but more complex

    • @HiBye-rq2mr
      @HiBye-rq2mr 3 роки тому +6

      nope

    • @fixel5578
      @fixel5578 3 роки тому +1

      @@HiBye-rq2mr 17h ago ok

    • @larryfranklin9106
      @larryfranklin9106 3 роки тому +2

      more like local but more complex

    • @HiBye-rq2mr
      @HiBye-rq2mr 3 роки тому +3

      fucking asked?

    • @hyterleaf754
      @hyterleaf754 3 роки тому +7

      no its not print but more complex sorry if im being rude im not trying to be

  • @isandreww
    @isandreww 2 роки тому +2

    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)

  • @VodkaDoge
    @VodkaDoge Рік тому +5

    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.

    • @toothcandle
      @toothcandle Рік тому

      i jsut going through taking notes as i go, usually one page per video but im trying my bestg

  • @KapsiF
    @KapsiF 2 роки тому +22

    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
      @sandpaper1711 2 роки тому

      so is there really any purpose to them? Do they like, make your game less laggy or something?

    • @KapsiF
      @KapsiF 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

    • @KapsiF
      @KapsiF 2 роки тому

      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

  • @GarnetTheif
    @GarnetTheif Рік тому +5

    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.

  • @mrplays0roblox615
    @mrplays0roblox615 6 місяців тому

    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.

  • @meeeem7056
    @meeeem7056 2 роки тому +11

    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.

    • @YelowBananaGamer
      @YelowBananaGamer Рік тому +1

      @PubxKitty911 for this you dont have to add " on Sweet unless it is used at the bottom called argument

    • @jeanlegs
      @jeanlegs 4 місяці тому +1

      THANK YOU SO MUCH I UNDERSTAND NOW!!!! Many hugs and *hotdogs* for you 😊

  • @the_dcr_pro6712
    @the_dcr_pro6712 3 роки тому +5

    My school : takes 2 years to get to function
    TheDevKing : your wish have came true

  • @johnnycrippledboy
    @johnnycrippledboy 3 роки тому +6

    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.

  • @ok23-j9c
    @ok23-j9c 3 місяці тому +1

    this guy exists yet people still dont know how to script this guy is a GIFT

  • @jadenquin6673
    @jadenquin6673 4 роки тому +34

    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
      @practicalcucumber1395 2 роки тому +2

      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.

    • @justarandomguywholovesanim726
      @justarandomguywholovesanim726 2 роки тому +3

      @@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

    • @demisemihemidemisemidescizxciv
      @demisemihemidemisemidescizxciv 2 роки тому

      @@justarandomguywholovesanim726 for real

    • @JustSoren5789
      @JustSoren5789 2 роки тому

      he's trying to express his likings for hotdogs

  • @nictactoe1496
    @nictactoe1496 3 роки тому +1

    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)

  • @Youtuber-sq2fj
    @Youtuber-sq2fj 5 років тому +6

    I am learning so much! I could not thank you enough! :D

  • @Ikmauki
    @Ikmauki Рік тому +1

    Bro, I watched TONS of tutorials and none of them made me understand but u did. I will sub to you

    • @Ikmauki
      @Ikmauki Рік тому +1

      local function amongus(imposter, crewmate)
      print(imposter+crewmate)
      end
      amongus(10,1)

  • @dusan310
    @dusan310 4 роки тому +5

    This guy really love hotdogs... xD

  • @eatmygames5870
    @eatmygames5870 3 роки тому +1

    i've been scripting for 1 year and i never learned i just watched others and im really starting to grasp this

  • @retrogamer9111
    @retrogamer9111 3 роки тому +4

    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

  • @reallycoolnerdisreallycool
    @reallycoolnerdisreallycool Рік тому +1

    TheDevKing: **tries to think of an example for variables**
    TheDevKing: h o t d o g

  • @user-do8jq4kd5z
    @user-do8jq4kd5z 3 роки тому +11

    Example:
    local function multiply(arg1, arg2)
    return arg1*arg2
    end
    local Variable = multiply(6, 2)
    print(Variable)
    it will print 12 because 6x2=12

    • @Quellyxx
      @Quellyxx 3 роки тому

      This comment made me understand the video, thanks man

    • @p_fu
      @p_fu 3 роки тому +2

      I was understanding the video but now I see your comment and it just ruined everything

    • @stuntfax9004
      @stuntfax9004 2 роки тому

      Can u. Make it simpler

  • @xoiuin
    @xoiuin 3 роки тому +2

    i swear this dude will unknowingly teach someone that will become a popular roblox dev in the future

    • @snoop9064
      @snoop9064 3 роки тому +1

      probably what happened with the creator of get a snack at 4 am. she mentioned thedevking in the credits page for his tutorials

  • @ggrelior3339
    @ggrelior3339 4 роки тому +10

    local function add(Number1, Number2, Text)
    print(Number1+Number2..Text)
    end
    add(1,3," yas")

  • @licanswok1789
    @licanswok1789 4 роки тому +1

    bro u deserve way more views ur tutorials are great

  • @Rickrolledhaha
    @Rickrolledhaha 8 місяців тому +3

    Hello! I know I am late since this video is 4 years ago but, may i ask what print(Hotdogs) does in the code?

    • @Gorillix2024
      @Gorillix2024 8 місяців тому +2

      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.

    • @justachillingcat
      @justachillingcat 8 місяців тому

      @@Gorillix2024 and hotdogs = 3,2 so it prints 5

    • @TutorialScapeYT
      @TutorialScapeYT 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!

  • @outfadingaway5400
    @outfadingaway5400 Рік тому

    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.

  • @ZZZ_Jaydee
    @ZZZ_Jaydee 4 роки тому +6

    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!

    • @ZZZ_Jaydee
      @ZZZ_Jaydee 3 роки тому +1

      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.

  • @wabi35
    @wabi35 3 роки тому

    The Most Helpful Person I Ever Watched, Continue Bro

  • @AngelShrimpChips
    @AngelShrimpChips 4 роки тому +5

    But couldn't I just add a variable. Why is there no "2" when called with a string?

    • @EB-db1us
      @EB-db1us 4 роки тому +1

      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)

    • @AngelShrimpChips
      @AngelShrimpChips 4 роки тому +2

      @@EB-db1us Oh that's makes more sense.

  • @DanAndWiz
    @DanAndWiz 6 місяців тому

    His tutorials are so good that I instantly understood what parameters are at 1:30

  • @frankmkk2191
    @frankmkk2191 4 роки тому +5

    Are you hungry watching these? 😂
    Thank you so much tho!

  • @SuperHraza
    @SuperHraza 3 роки тому +1

    Your tutorials are so simple and I love your jokes
    If I were to pick any UA-cam tutorial i would choose yours :D

  • @qrisquinn
    @qrisquinn 5 років тому +3

    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.

    • @lost_spammer9984
      @lost_spammer9984 3 роки тому

      Watch alvin bloxx his tutorial also explains about parameters check it out.

  • @zemadz7567
    @zemadz7567 Рік тому +1

    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.

  • @itsmegreg9872
    @itsmegreg9872 5 років тому +11

    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.

    • @TeamTrapMike
      @TeamTrapMike 5 років тому +10

      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!

    • @TheBean42069
      @TheBean42069 4 роки тому +2

      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

    • @shinchanthebest
      @shinchanthebest 4 роки тому +1

      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 ;)

    • @Splash滴
      @Splash滴 4 роки тому

      @@TeamTrapMike Yeah he's right all of this will forever be needed in order to get into the complicated stuff.

    • @hollxie2298
      @hollxie2298 4 роки тому +2

      @Mike C I’m actually 10 and almost in the advanced series. (:

  • @silviaavdala4964
    @silviaavdala4964 2 роки тому

    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

  • @coolkidathome8203
    @coolkidathome8203 4 роки тому +4

    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.

  • @youcancallmeantsgames833
    @youcancallmeantsgames833 3 роки тому +1

    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

  • @sebguydude8569
    @sebguydude8569 4 роки тому +3

    For some reason I think returning is the easiest.

  • @zBleep
    @zBleep Рік тому

    Damn, this is probably the only concept outside of printing that I learned without having to practice after, thank you!

  • @baconhairawesomeyeah7528
    @baconhairawesomeyeah7528 2 роки тому +4

    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

    • @Safesplayz
      @Safesplayz Рік тому +1

      thanks man this really helped a lot

  • @MeowToonYT
    @MeowToonYT 5 місяців тому +1

    Protect this man at all cost!!!!

  • @Chonmil
    @Chonmil 2 роки тому +2

    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.

  • @Bbe78
    @Bbe78 3 місяці тому

    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.

  • @rx7.teykhan683
    @rx7.teykhan683 4 роки тому +1

    God give this man some hotdogs...

  • @noobsarebetterthanu5820
    @noobsarebetterthanu5820 2 роки тому

    He seems so sweet and optimistic and i LOVE IT he also tends to put hotdog in the scripts a lot lmao.

  • @newbie8114
    @newbie8114 3 роки тому +1

    :O!
    Hotdog is evolving! Hotdog involved into.. a... HotHamDog?
    2:27

  • @backkslashhh
    @backkslashhh 3 роки тому +1

    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)

  • @ClipaMation
    @ClipaMation 20 годин тому +1

    so basically parameters are just variables that can have multiple values

  • @sparshgupta629
    @sparshgupta629 4 роки тому +2

    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)

  • @surekhapitta2139
    @surekhapitta2139 4 роки тому +2

    Wow easy understanding
    Every one should teach like you

  • @Bababoyiscool
    @Bababoyiscool 5 місяців тому

    The way you explain is so easy! I have liked and subbed with notifications on!

  • @2kb1ynx76
    @2kb1ynx76 Рік тому +1

    When u were doing the variable why didn’t u do it like local then hot dog = 3 then ham = 2 why did u only do the ,

  • @jordankidd230
    @jordankidd230 3 роки тому +1

    Alvinblox: hamburger
    Devking: hotdog

  • @thelastsliceofcheese9057
    @thelastsliceofcheese9057 4 роки тому +1

    I think he was hungry when he was making this and he cant stop thinking about food.

  • @Double_Dead
    @Double_Dead Рік тому

    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)

  • @stultar
    @stultar Рік тому

    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)

  • @badreddinedjouamaa5555
    @badreddinedjouamaa5555 2 роки тому +1

    its like Vars and each Var you giving it a different value of either a number or a word and it prints the results , btw is this playlist st ill good to watch in 2022 ?

  • @otheturtle4028
    @otheturtle4028 4 роки тому +1

    I never thought I would enjoy learning

    • @franciscohernandez5765
      @franciscohernandez5765 4 роки тому

      What can we use these scripts for? I’m trying to make a anime game and this isn’t helping very much

  • @gigachad4472
    @gigachad4472 3 роки тому +1

    You're my best teacher!

  • @keen5760
    @keen5760 2 роки тому +1

    local function car(firstpart, secondpart, thirdpart)
    print("car contains", firstpart, "and", secondpart, "and", thirdpart)
    end
    car("engine", "windows", "frame")
    an example :)

  • @ClippedCombat
    @ClippedCombat Рік тому

    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.

  • @justine3615
    @justine3615 Рік тому

    You sure does love hotdogs xD btw nice tutorials i'm learning so much

  • @andreabobekova2340
    @andreabobekova2340 9 місяців тому +1

    What apps do u use if u are on school wifi?

  • @imrantube747
    @imrantube747 2 роки тому +1

    The part i am confused about is how does any of this have to do with functions?

  • @noob_toxic1719
    @noob_toxic1719 3 роки тому +1

    some other youtubers take 30 minutes to explain something
    this man takes 5 minutes to explain the same thing and 10x easier

  • @bawad201
    @bawad201 8 місяців тому +1

    Buld really just said "deaf king"

  • @PrawnRae
    @PrawnRae 11 місяців тому +1

    bro's favourite word is hotdog LOL

  • @Random-pc1cs
    @Random-pc1cs 2 роки тому

    Pov: returning from advanced series to parameters cause you dont understand how parameters work and cant make the tool damage people

  • @practicalcucumber1395
    @practicalcucumber1395 2 роки тому +1

    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

  • @inussahiscool
    @inussahiscool 11 місяців тому +1

    I usually use scratch and this kinda reminds me of custom blocks

  • @MrGuy-mw3pl
    @MrGuy-mw3pl Рік тому +2

    Ok i might be to late but at 4:29 when he is wrtiing sweet cool awesome and others why doesnt it print 2?

    • @Zexa3
      @Zexa3 Рік тому

      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.

    • @patoyt1437
      @patoyt1437 Рік тому

      Ham is 2, but it si not printed because he did not print ham, he printed hotdog

    • @coolboybrazilshorts
      @coolboybrazilshorts 4 місяці тому

      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

  • @arunmoses2197
    @arunmoses2197 3 роки тому

    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

  • @Targetstrike
    @Targetstrike 3 роки тому +2

    I am surprised at how little confusion I have about all these, especially since I'm taking notes
    I got through scope and returning with a good idea of what it is

    • @Targetstrike
      @Targetstrike 3 роки тому

      I already know printing by now because it does the same thing in python

    • @Ziedmac
      @Ziedmac 2 роки тому

      thanks for the idea of taking notes, idk why I didn't think of that earlier! I kept forgetting everything from the earlier videos but just rewatched them and took notes

  • @ScaryRBLX
    @ScaryRBLX 7 місяців тому +2

    I might be late xD, i've just started roblox studio yesterday and i've been doing animations and scripting, i dont understand what functions are for, what is Parameter, What scope and Return are for, what string is (which i think is the ("Hotdog") thing, please answer if any of you guys know or you DevKing

    • @ScaryRBLX
      @ScaryRBLX 7 місяців тому

      @SaadTahir-yx1gt Thats nice! There is also an advanced tutorial just so you know :D i kinda took a break since it just got boring and i lost motivation but im going to get back on my feet sooner or later

  • @landroid6467
    @landroid6467 5 років тому +1

    I get that when you talk abt functions and parameters or returns that you're using the print example to show what they do but people want to know how they can actually be applied when scripting a game not just printing words into output.

    • @emmanuelnsiah8036
      @emmanuelnsiah8036 4 роки тому

      true I want to to know how you put in a script and not in print

  • @navegadornosferatu4354
    @navegadornosferatu4354 4 роки тому +1

    so please correct me if im wrong but a practical example would be a fighting game, and use it to create a punch function. you could use the parameter to have, for example, a normal punch and a heavy punch?

    • @mikeyaboii8210
      @mikeyaboii8210 4 роки тому

      yes that would work. but I would probably separate the functions for that.

  • @Code-002
    @Code-002 2 роки тому

    My man mentioning his bros Hotdog and Hamburger in each episode👍
    Pure dedication to his homies👌

  • @1Name8R
    @1Name8R Рік тому

    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)

  • @SuperHraza
    @SuperHraza 3 роки тому +1

    What would happen if you printed hotdogs and ham
    Will it turn into sweet2 when you add sweet and 2?

    • @leonardobagi9353
      @leonardobagi9353 3 роки тому +1

      Only if 2 is also a string.
      add("sweet", "2") would work
      But if you used
      add("sweet", 2) it would return an error, bc in a static typed language (u dont need to know this) as the case of lua, you can only add param/variables of the same type (string + string, integer + integer, etc)

  • @brocockman5116
    @brocockman5116 2 роки тому

    if you dont understand paramaters are literally just variables that can be changed but can only be used inside the function its created in

  • @DedeyeRBLX
    @DedeyeRBLX Рік тому +1

    Why would someone use returns

  • @ordinarynerdofficial
    @ordinarynerdofficial Рік тому

    im still learning so correct me if im wrong but for people who dont understand Hotdog is the same as "local Hotdog = 3" and Ham is the same as "local Ham = 2" so when you print "print(Hotdog + Ham)" its like printing 3 + 2

  • @limitedfair
    @limitedfair 3 роки тому +2

    0:38 just commenting so i remember where i am