Parameters, Math, & Returns - Roblox Beginners Scripting Tutorial #7 (2024)

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ม.ค. 2025

ความคิดเห็น • 1.3K

  • @VoltigarRBLX
    @VoltigarRBLX 6 หลายเดือนก่อน +342

    I've struggled in the past with basic scripting concepts, whether it's because it's hard to pay attention or whatever it may be. I am able to speed up and slow down the videos and your speech is so incredibly consistent and clear that I can always understand what you're saying. All around really fantastic stuff, you have a real talent for explaining concepts just enough to the point where it's understandable without overexplaining or underexplaining. The only thing I think would increase my understanding (this may just be personal preference) is providing real-world/real-game examples (damage calculation, inventory, whatever it may be) of where parameters can come in handy and when it would make sense to apply different arguments to the same function parameters. Aside from that, just really perfect stuff, thanks a lot.

    • @cjstrong7056
      @cjstrong7056 5 หลายเดือนก่อน +16

      Agreed, Agreed, and Agreed

    • @Thefourdelinquents-q6b
      @Thefourdelinquents-q6b 5 หลายเดือนก่อน +3

      Yeah like I wanna make games but it’s just hard for me to watch so much tutorials until I get it

    • @jfeondkthz
      @jfeondkthz 5 หลายเดือนก่อน +7

      holy glaze 🙏

    • @VoltigarRBLX
      @VoltigarRBLX 5 หลายเดือนก่อน +8

      @jfeondkthz pretty exclusively constructive feedback, but I guess in circles where there's only insecure men you can't even compliment each other or give feedback without people reading it some kinda weird way

    • @Demonsinful
      @Demonsinful 4 หลายเดือนก่อน

      ​@@VoltigarRBLX I mean he is kinda glazing the man

  • @TheNewBeh564
    @TheNewBeh564 3 หลายเดือนก่อน +74

    Please don't stop with this series even though your not getting as much views, its grateful to me and to some other people, you've been explaining it perfectly to me and im learning faster than I thought I would!
    Anyways, some code I made from this video:
    local function addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = addition(8, 2 )
    print(printResult)
    local function subtraction(number144, number4)
    local result = number144 - number4
    return result
    end
    local printResult = subtraction(144, 4 )
    print(printResult)
    local function multiplication(number12, number12)
    local result = number12 * number12
    return result
    end
    local printResult = multiplication(12, 12)
    print(printResult)
    local function division(number36, number6)
    local result = number36 / number6
    return result
    end
    local printResult = division(36, 6)
    print(printResult)
    😅

    • @Noob-c7m
      @Noob-c7m หลายเดือนก่อน +2

      Awesome work dude!

    • @Weirdo42
      @Weirdo42 19 วันที่ผ่านมา +1

      Im learning what everything means but no chance ima know what to do with it (no hate)

    • @4shadow2
      @4shadow2 3 วันที่ผ่านมา

      @Weirdo42 im planning on just using an uncopylocked game and improving it or messing around in it

  • @summeranan6969
    @summeranan6969 5 หลายเดือนก่อน +90

    This coding series is actually helping me open up. I used countless different tutorials to try and learn, but they go way too fast, and not that specific. This tutorial is perfect. I love the way you go slow and steady, and you break everything deep so I can understand every single concept. Thank you!! +1 Sub

    • @SomiSonicPlayz
      @SomiSonicPlayz หลายเดือนก่อน +1

      same

    • @laishunsin4984
      @laishunsin4984 หลายเดือนก่อน

      Same

    • @justwalee
      @justwalee 7 วันที่ผ่านมา

      subscribers += 1
      if you will :)

  • @jun-dq9bt
    @jun-dq9bt 2 หลายเดือนก่อน +123

    Return part was confusing asf for me and i believe for some people too but now that i understand it heres a easy way to understanding.
    For instance, we have
    local function addition (a, b)
    local result = a + b
    return result

    end
    local printResult = addition(8,2)
    print(printResult)
    If we translate this into english, its like saying "Hey Roblox, when i ask for the result for a + b, you calculate the result and RETURN to me that value. In this scenario, a = 8 and b = 2, find the result of 8 + 2 then RETURN to me that value" So in output you gonna see 10.
    return : exit a function and pass back a value to the caller.

    • @Achilles-f9g
      @Achilles-f9g 2 หลายเดือนก่อน +15

      whats the difference in saying print(result) then saying return resul

    • @thecoalcub6012
      @thecoalcub6012 หลายเดือนก่อน +8

      @@Achilles-f9gI'm not an expert scripter or anything but I believe difference is that if you don't return the function it doesn't actually pass a value back to the caller. It's basically the difference between you telling someone a command to do something vs asking that someone a question and getting an answer to it.

    • @Suiiro
      @Suiiro หลายเดือนก่อน +19

      @@Achilles-f9gall printing the result is doing is just printing it into the output (console) for the dev to see, it doesn’t do anything for the game whatsoever. Returning though actually does something with the script itself and its not just visual

    • @DavidTheApex
      @DavidTheApex หลายเดือนก่อน +5

      your a cool man i just wanna mention that ty so much for this comment

    • @cutesy2282
      @cutesy2282 หลายเดือนก่อน +5

      @@Suiirowhat’s it doing to the game?

  • @vali0us
    @vali0us 3 หลายเดือนก่อน +33

    After doing python in school I've realised that python and lua have a lot of similarities and I'm enjoying learning a new programming language thanks for this video.

    • @fangyongsun7182
      @fangyongsun7182 หลายเดือนก่อน +1

      lua is like python + javascript

    • @chelito_acc4895
      @chelito_acc4895 หลายเดือนก่อน

      And with c

    • @ProtonzProcessing
      @ProtonzProcessing หลายเดือนก่อน +1

      It seems we have similar interests. Both dandadan and coding :)

    • @5eyoshi
      @5eyoshi 17 วันที่ผ่านมา

      Same

  • @jushazen6906
    @jushazen6906 9 วันที่ผ่านมา +5

    Not gonna lie, learning lua while having a background in other languages feel like a superpower. I'm speedrunning these videos with ease. Thanks so much BrawlDev

    • @UraborosGaming
      @UraborosGaming 6 วันที่ผ่านมา

      after using Java for 5 years this feels like a kiss from an angel ngl

  • @saikonick8312
    @saikonick8312 3 หลายเดือนก่อน +11

    most of your vids have the same views, that means that you make ppl be happy to learn coding! Be proud of that!

  • @TheEpicFire
    @TheEpicFire 2 วันที่ผ่านมา +1

    I love these tutorials bro, they're actually so good and crystal clear to understand. Here's what I made for my script.
    -- Math Functions
    local function addition (number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = addition(4, 5)
    print(printResult)
    local function multiply (num1, num2)
    local results = num1 * num2
    return results
    end
    local printMultiply = multiply(1, 5)
    print(printMultiply)
    local function divide (num1, num2)
    local results = num1 / num2
    return results
    end
    local printDivision = divide(4, 2)
    print(printDivision)
    local function power (num1, num2)
    local results = num1 ^ num2
    return results
    end
    local printPower = power(6, 3)
    print(printPower)

  • @imvolley
    @imvolley 4 หลายเดือนก่อน +5

    It's been slow for me so far, but I feel like I'm starting to really grasp it. This one def had me stumped a lot but I understand it now that I've simplified it for myself.
    local function addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = addition(8, 2)
    print(printResult)
    local function subtraction(number3, number4)
    local Result = number3 - number4
    return Result
    end
    local Printresult = subtraction(8,5)
    print(Printresult)
    local function multiply(number5, number6)
    local answer = number5 * number6
    return answer
    end
    local answerResult = multiply(5,5)
    print(answerResult)

  • @AustinNarvaez-p4d
    @AustinNarvaez-p4d หลายเดือนก่อน +2

    These are really helpful. It's not often I find tutorials as thorough and clear as these, especially related to scripting now that I'm trying to learn. Here's what I did:
    local function addition(number1, number2)
    local addResult = number1 + number2
    return addResult
    end
    local printAddResult = addition(8, 2)
    print(printAddResult)
    local function subtraction(numb1, numb2)
    local subtractResult = numb1 - numb2
    return subtractResult
    end
    local printSubtractResult = subtraction(3, 9)
    print(printSubtractResult)
    local function multiplication(num1, num2)
    local multiplyResult = num1 * num2
    return multiplyResult
    end
    local printMultiplyResult = multiplication(5, 1)
    print(printMultiplyResult)
    local function division(n1, n2)
    local divideResult = n1 / n2
    return divideResult
    end
    local printDivideResult = division(6, 3)
    print(printDivideResult)

  • @SupcomradeGames
    @SupcomradeGames 6 หลายเดือนก่อน +6

    This is truly amazing stuff, you explain it in such a simple way, thank you, I've been trying to find good videos and none of them explain anything, nearly as well as this one does.

  • @sereneybeanie6733
    @sereneybeanie6733 4 หลายเดือนก่อน +1

    I was having a hard time with parameters and return statements for a while now and this helped me understand at least a little more so thank you!
    Here's what I did for the learning objective btw:
    local function subtraction(number1, number2)
    local result = number1 - number2
    return result
    end
    local printSResult = subtraction(2, 1)
    print("Subtraction result: ", printSResult)
    local function multiplication(number1, number2)
    local result = number1 * number2
    return result
    end
    local printMResult = multiplication(8, 2)
    print("Multiplication result: ", printMResult)
    local function division(number1, number2)
    local result = number1 / number2
    return result
    end
    local printDResult = division(5, 2)
    print("Division result: ", printDResult)

  • @Life_of_Boredom
    @Life_of_Boredom 5 หลายเดือนก่อน +45

    If anyone is still confused on what the return statement is, it’s essentially telling the next line to follow the same perameters and functions (or in a way returning the parameters and functions) which allows him to do a new variable and still have it do the calculations without having to lay out the parameters and telling it how to calculate the numbers again, it’s more of a neat organizing thing which will help your code stay organized. (This is how I interpreted it, someone please correct me if I am wrong.)

    • @prozabdielzoo3212
      @prozabdielzoo3212 5 หลายเดือนก่อน +2

      Omg you just saved me another 1 or 2 days trying to figure this out ty!!!

    • @Capy5687
      @Capy5687 5 หลายเดือนก่อน +8

      It took all of my braincells to understand this concept

    • @nyanay0
      @nyanay0 4 หลายเดือนก่อน +1

      the next line is "end"

    • @liviii4188
      @liviii4188 4 หลายเดือนก่อน +2

      so the return statement lets you use the result of a function elsewhere in your code without repeating the calculations?

    • @Contemptical
      @Contemptical 4 หลายเดือนก่อน

      i thnk what it does is return tells the function to use the values given without needed to be told if its adding, subtracting etc

  • @OnePiece_Dimension
    @OnePiece_Dimension 4 หลายเดือนก่อน +17

    Thank you BrawlDev for the Informativ Video this is what i have done for my Learning Objectiv!
    --MATH, PARAMETRES & RETURNS
    --RETURN
    local function Plus(Num1, Num2)
    local PlusSummen = Num1 + Num2
    return PlusSummen
    end
    local Ergebnis = Plus(10, 5)
    print(Ergebnis)
    --PARAMETRES
    local function Minus(Num1, Num2)
    local MinusSummen = Num1 - Num2
    print(MinusSummen)
    end
    Minus(5, 2)
    --MATH
    local Divison = 2 / 2
    print(Divison)
    local Multiplikation = 2 * 2
    print(Multiplikation)

    • @AEROMAX
      @AEROMAX 3 หลายเดือนก่อน +3

      I love how this isn’t even confusing to me anymore after this video

    • @HunterMankee-w1z
      @HunterMankee-w1z 2 หลายเดือนก่อน

      @@AEROMAX same 😭

  • @KindBloom100
    @KindBloom100 5 หลายเดือนก่อน +5

    i like how you just give us homework but instead of it being really boring you make it feel like i want to do it! Just wanted to point that out😅

    • @TarekTRBW
      @TarekTRBW 4 หลายเดือนก่อน

      Agree

    • @TarekTRBW
      @TarekTRBW 4 หลายเดือนก่อน

      Attractive homework bro needs to be teacher

  • @mayineverfalter
    @mayineverfalter 7 หลายเดือนก่อน +53

    local function addition(number1, number2)
    local result = number1 + number2 -- creates a result of the addition of two functions
    print(result) -- prints out the result
    end
    addition(5, 2) -- the difference between arguments and parameters is: parameters are used to create variables, arguments are what values we throw into the function
    addition(5, 2)
    addition(4, 3)
    local function additionv2(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = additionv2(8, 2)
    print(printResult)
    -- return can also be used to exit out of functions, which means that it can end the function at whatever line it is called.
    local function subtraction(number1, number2)
    local result = number1 - number2
    print(result)
    end
    subtraction(3, 2)
    local function division(number1, number2)
    local result = number1 / number2
    print(result)
    end
    division(2, 2)

    • @polegamerstv7035
      @polegamerstv7035 6 หลายเดือนก่อน +1

      TYSM you just saved me 13 mins!

    • @pinkofthedude
      @pinkofthedude 6 หลายเดือนก่อน +20

      @@polegamerstv7035 No he didnt, just having that script isnt gonna help you learn anything.

    • @ILJI_12
      @ILJI_12 6 หลายเดือนก่อน +1

      we have the same profile picture

    • @EdwardEnglish-j2h
      @EdwardEnglish-j2h 6 หลายเดือนก่อน

      *head banging on desk* *gets concussion*
      My brain: thATs WhaT i hAVe tO dOoooOOoooooo?
      I DONT WANNA
      Proceeds to get brain damage

    • @polegamerstv7035
      @polegamerstv7035 6 หลายเดือนก่อน +3

      @@pinkofthedude no he did? I already know like 2 coding languages the only thing i need to know is the words here to use it i know functions and other things im just watching to make sure

  • @questionmarkdude4910
    @questionmarkdude4910 4 หลายเดือนก่อน +2

    i understood pretty quick and the explaination is simple!!!
    here's my script
    local function addition(num1, num2)
    local result = num1 + num2
    return result
    end
    local function subtraction(num3, num4)
    local result1 = num3 - num4
    return result1
    end
    local function multiplying(num5, num6, num7)
    local result2 = num5 * num6 * num7
    return result2
    end
    local printResult = addition(8, 2)
    print(printResult)
    local printResult1 = subtraction(5, 2)
    print(printResult1)
    local printResult2 = multiplying(2, 4, 3)
    print(printResult2)

  • @osakadev
    @osakadev 7 หลายเดือนก่อน +45

    List of math operators (if you want these):
    Substraction: -
    Addition: +
    Multiplication: *
    Division: /
    Power: ^ ( same as doing math.pow(x, y) )
    Scientific notation: 10e4 (or any number, an "e" and any number)
    Floor division: // ( the same as doing math.floor(x / y) )
    Modulus: %
    I dont know if I miss another one

    • @BedwarsRBLX
      @BedwarsRBLX 7 หลายเดือนก่อน +1

      Modulus

    • @osakadev
      @osakadev 7 หลายเดือนก่อน

      @@BedwarsRBLX true

    • @s1nblitz
      @s1nblitz 7 หลายเดือนก่อน +4

      += and -= are also operators too
      they can be used for taking damage
      so instead of doing like
      health = health - 20
      you can just do
      health -= 20

    • @osakadev
      @osakadev 7 หลายเดือนก่อน +1

      @@s1nblitz Those are compound operators, not math operators, I'm talking about math operators

    • @CrackedUpEgg
      @CrackedUpEgg 5 หลายเดือนก่อน

      mine:
      rad (radius i think)
      pi
      circumference
      sin
      square root
      ratio
      abs (absolute) (Length from zero)
      cosine
      round
      >.

  • @bransonroblox3344
    @bransonroblox3344 29 วันที่ผ่านมา +1

    I am having a hard time catching up, but after rewatching your video twice, I understand it now. The return function was quite hard to understand but I think i got the hang of it for this episode. Thank You!
    Here's my script:
    1)Addition
    local function addition(number1, number2, number3, number4)
    local resulttrue = number1 + number2 + number3 +number4
    return resulttrue
    end
    local printresulttrue = addition(1, 2, 3, 4)
    print(printresulttrue)
    2)Subtraction
    local function subtraction(number1, number2, number3)
    local resulttrue = number1 - number2 - number3
    return resulttrue
    end
    local printresulttrue = subtraction(10, 6, 3)
    print(printresulttrue)
    3)Multiplication
    local function multiplication(number1, number2, number3)
    local resulttrue = number1 * number2 * number3
    return resulttrue
    end
    local getresulttrue = multiplication(2, 2, 3)
    print(getresulttrue)
    4)Division
    local function division(number1, number2)
    local resulttrue = number1 / number2
    return resulttrue
    end
    local getresulttrue = division(9, 3)
    print(getresulttrue)
    5)Addition and Multiplication
    local function additionandmultiplication(number1, number2, number3)
    local resulttrue = number1 + number2 * number3
    return resulttrue
    end
    local getresulttrue = additionandmultiplication(4, 2, 3)
    print(getresulttrue)
    6)Subtraction and Division
    local function subtractionanddivision(number1, number2, number3)
    local resulttrue = number1 - number2 / number3
    return resulttrue
    end
    local getresulttrue = subtractionanddivision(10, 9, 3)
    print(getresulttrue)

  • @daniel_denamit724
    @daniel_denamit724 6 หลายเดือนก่อน +10

    i was a bit confused about the part with return but after rewatching it like 3 times i understood it more thanks for the video!

    • @Korudo23
      @Korudo23 5 หลายเดือนก่อน

      you think youd be able to elaborate it?

    • @ioproto6581
      @ioproto6581 5 หลายเดือนก่อน

      ​@@Korudo23 Here's how I understood it myself; thinking about how we can use the value after we return it. A return is effectively keeping the end value, whereas printing is only telling the console what the value is. For example, if we had a function
      local function addTwo(X, Y)
      local result = X + Y
      print(result)
      end
      This is simply just adding two numbers like what the video demonstrated!
      Say we wanted to run this function twice and print the end result of adding two sets of numbers together.
      We cannot do a
      print(addTwo(1,1) + addTwo(2,2)), because we're asking it to add two numbers twice, but we haven't told it to keep the end values of those two individual addition executions we're asking it to do (we tell it to do 1+1, but then just output the result in the console with the 'print' command, and same for the 2+2). We've only told it to print the result. If we return the result, we are asking it to remember the end of the two individual executions of the function.
      In other words, with the print line above, we've asked it to add 1 + 1, and then print that value. Then, add 2 + 2, and print that value. But then we're asking it to add... what? We haven't asked it to remember that 1 + 1 = 2 and 2 + 2 = 4, so it cannot do what we would expect (2 + 4).
      Instead, if our addTwo function was this
      local function addTwo(X, Y)
      local result = X + Y
      return result
      end
      Now, because of the return, we're asking it to remember its end result upon every execution. So now we can do our
      print(addTwo(1,1) + addTwo(2,2))
      Because now we're telling it to print the end result of (1+1) PLUS (2+2), and it will print 6 as the output in the chat.
      If this doesn't make sense let me know and I can try to reclarify.

    • @BruhEditsFr
      @BruhEditsFr 5 หลายเดือนก่อน +11

      @@Korudo23 Basically return is returning values. For example: I give 5$ for a burger in return I get a burger. Read this 4 times and u should get it.

    • @E.TDelusional
      @E.TDelusional 3 หลายเดือนก่อน +1

      @@BruhEditsFr ooo i see now, but how is it different from using the arguments. Like is it better to use?

    • @Aeioueeeeee
      @Aeioueeeeee 3 หลายเดือนก่อน

      I don’t understand. I understand ur example but not how it fits into the topic.(I don’t mean it offensive I just don’t speak English as my 1st language)
      I think it would logically be the same without return and not make a difference, but without it it won’t work…
      Idk

  • @illialomonovski4789
    @illialomonovski4789 4 วันที่ผ่านมา

    Very nice video! Fortunately understood every topic that was mentioned in the tutorial.
    Here's what I did for the Learning Objective:
    local function addition(number1, number2, number3)
    local result = number1 + number2 + number3
    return result
    end
    local additionResult = addition(91, 82, 100)
    print(additionResult)
    local function subtraction(number1, number2, number3)
    local result = number1 - number2 - number3
    return result
    end
    local subtractionResult = subtraction(1000, 712, 199)
    print(subtractionResult)
    local function multiplication(number1, number2, number3)
    local result = number1 * number2 * number3
    return result
    end
    local multiplicationResult = multiplication(80, 43, 52)
    print(multiplicationResult)
    local function division(number1, number2, number3)
    local result = number1 / number2 / number3
    return result
    end
    local divisionResult = division(8000, 2, 400)
    print(divisionResult)
    local function complexMath(number1, number2, number3)
    local result = number1 * number2 / number3
    return result
    end
    local complexMathResult = complexMath(19, 2, 129)
    print(complexMathResult)

  • @SimplyTutuco
    @SimplyTutuco 4 หลายเดือนก่อน +6

    This is really interesting, but a little confusing.
    *For what I understood, the return command stores the result of whatever is the function for it to be used again without it having to call the function and calculate it all again. If I'm wrong, please correct me.*
    Here's what I did for the LO:
    local function solveSequence(n1, n2, n3, n4, n5)
    local sequenceResult = n1 * n2 - n3 - n4 + n5
    return sequenceResult
    end
    local SResult = solveSequence(3, 7, 9, 5, 2)
    print(SResult)
    local function epicFunction(epicness, awesomeness)
    local coolness = epicness + awesomeness
    return coolness
    end
    local totalCoolness = epicFunction(3910, 4927)
    print(totalCoolness)
    I understood math, parameters and arguments but somehow couldn't understand returns that well.

    • @Demonsinful
      @Demonsinful 4 หลายเดือนก่อน

      Wdym
      ,It returns the local function I think you need a dictionary it's literally straight forward.

    • @AanybrosS
      @AanybrosS 2 หลายเดือนก่อน

      So my question is why did u in particular use the word n like wasn’t there any other word

    • @GrieferBT
      @GrieferBT 2 หลายเดือนก่อน +3

      I will correct you:
      In order to actually understand returns, you need to realize that function calls (ex: function(n1, n2)) are actually values. The problem is that you actually have to tell the script that the result of the arguments being calculated is the value of said function call. The ‘return’ command does just that.
      If you don’t put in the return command, the script just runs the function and discards the result after the ‘end’ command is read. Make sense?

    • @cutesy2282
      @cutesy2282 20 วันที่ผ่านมา

      @@GrieferBTmaybe can you expand a bit? 😭

    • @GrieferBT
      @GrieferBT 20 วันที่ผ่านมา

      @@cutesy2282 Okay…So basically when you type something like this into a script:
      _”variable = function (n1, n2)”_
      You’re telling the script to make this variable’s value whatever the function returns. But without the return command, the function call doesn’t get the result, so then the script basically just says “the value of this variable is simply the fact that the function ran.”
      And I’ll put this information into a scenario:
      - - -
      Imagine a friend _(the variable)_ asks you _(the function call)_ to go to a vending machine _(the function)_ and get them a snack _(the result of the function)._
      So, you do that: you pick a snack _(insert the arguments)_, and the vending machine takes the one you want and pushes it down _(completes the instructions inside the function)_.
      But then there’s a problem. Having no return command is like the vending machine pushing the snack down to the little door at the bottom, but never opening said door for you to grab it. It did the work just fine, but never gives you the result of its work; it stays locked up. The return function is basically what feels the vending machine to open the door.
      - - -
      Basically, the core concept is that function calls tell the function to work but unless the return function actually tells the call “hey, this result is your value” then it won’t have a value to give the variable.
      If you still don’t understand after how much I broke it down…idk what to say ur just kinda not that bright

  • @NsoYIPPEE
    @NsoYIPPEE 26 วันที่ผ่านมา

    so far this series is making me happy to learn more, i like the way you teach and explain slowly in every details like making sure we all understand. Thankyouuu

  • @RSM_ONION
    @RSM_ONION 4 หลายเดือนก่อน +22

    My interpretation of the return command
    local function addition(number1, number2)
    local result= number1 + number2
    return (result)
    end
    local printResult = addition(8, 2)
    print (printResult)
    in this example number1=8 and number2=2
    8+2=10
    result=10
    return result is basically just sending result back in place for the "addition(8,2)
    so local printResult = 10
    therefore
    print (printResult) prints "10"

    • @Michael-sg2ek
      @Michael-sg2ek หลายเดือนก่อน

      could u help me if u still remember how to do this why is return statement only needed if you have
      local printResult = addition(8, 2)
      print(printResult)
      and not
      print(addition(8, 2))

    • @rafiasultana222
      @rafiasultana222 หลายเดือนก่อน

      See if you print(printResult)
      Or
      Print(addition(8,2))
      We are getting the same answer so as for that we could have directly written
      local addition(8,2)
      Because here the above statement we were naming it as printResult so in easier words its just a=10
      So here a value is 10
      Same like that here printResult value is addition

  • @Iheart.Elysia
    @Iheart.Elysia หลายเดือนก่อน

    I just made a small calculation that I struggled with to make it printed with the correct number. I thank you for helping me in understanding the aspect of scripting and coding for Roblox Studio, since my course teacher isn't really helpful and just told me to copy-paste stuffs :D
    Here's the code I wrote, although I don't know it's correct with your way or not, but it did printed out the result correctly :
    local function mathematical (numerical3x, times3, number2y, times2)
    local way = (numerical3x * times3) - (number2y * times2)
    print(way)
    return way
    end
    local printResult = mathematical(6, 3, 4, 2)
    print (printResult)

  • @binaryglitchh
    @binaryglitchh หลายเดือนก่อน +3

    i wrote:
    local function addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = addition(8, 2)
    print(printResult)
    local function subtraction(n1, n2)
    local result = n1 - n2
    return result
    end
    local printResult = subtraction(10, 12)
    print(printResult)
    local function multiplication(n1, n2)
    local result = n1 * n2
    return result
    end
    local printResult = multiplication(12,8)
    print(printResult)
    local function divison(n1, n2)
    local result = n1 / n2
    return result
    end
    local printResult = divison(100, 4)
    print(printResult)

  • @planktonuser660
    @planktonuser660 3 หลายเดือนก่อน

    as a student taking cs major learning other coding languages, its nice that lua scripting is pretty simple, but even then im still learning alot of things that i am able to connect to other languages. Thankful for this video

  • @V4x07
    @V4x07 4 หลายเดือนก่อน +15

    here's mine which i tried to do, first i tried:
    ''if hp < 1 then
    print('You died')
    end''
    and it told me that i cant compare hp to a number because is a ''nil'', so i stood there in front of my screen, during like 10 mins thinking what to put, and i magically thought of replacing ''hp'' for ''hpLeft'', and it worked. Let me know if the script is okay, ik it most likely isnt the best option for a damage and hp system for a fighting game but im a beginner and i wanna know if i did good so far with this attempt, here's the script:
    local function critHit(hp, dmgtaken)
    local TotalDmg = hp - dmgtaken
    return TotalDmg

    end
    local hpLeft = critHit(50, 60)
    if hpLeft < 1 then
    print("You died")
    end

    • @DevBimon69
      @DevBimon69 3 หลายเดือนก่อน +1

      wow nice, this is so cool

    • @Roman_play012
      @Roman_play012 3 หลายเดือนก่อน +1

      it doesn't actually work, i copied to test and it showed me "you died" before even dying

    • @python5248
      @python5248 3 หลายเดือนก่อน +1

      Hmm that's prolly bcus the variable hpLeft prolly went in decimals so smth like
      If hpLeft

    • @avishyyakobov
      @avishyyakobov 3 หลายเดือนก่อน +3

      Nice creativity!
      I kinda upgraded your code so if you stay alive it says "You're alive"
      local function critHit(hp, dmgtaken)
      local TotalDmg = hp - dmgtaken
      return TotalDmg
      end
      --change the hp to a number higher than dmgtaken to be alive
      local hpLeft = critHit(50, 60)
      if hpLeft

    • @python5248
      @python5248 3 หลายเดือนก่อน +2

      @@avishyyakobov Yooo my code works? Dats so cool thnx🔥🔥🔥

  • @phonkguy-u4n
    @phonkguy-u4n หลายเดือนก่อน +2

    this makes me so happy idk why

  • @Timuçinn1
    @Timuçinn1 6 หลายเดือนก่อน +16

    local function addition(burger1, burger2)
    local price = burger1 + burger2
    return price
    end
    local printprice = addition(3.99, 5.99)
    print(printprice)
    2 burger price is 9.98

    • @ironkiller6504
      @ironkiller6504 หลายเดือนก่อน +1

      but why do u have to use the return function? if u wouldnt say return, the burgers price would still be 9,98 soo?? i just cant understand it even though im scripting since months

  • @kur0c0d33rr0r
    @kur0c0d33rr0r หลายเดือนก่อน

    thank you sm for this tut!
    local function add(number1, number2)
    local addres = number1 + number2
    return addres
    end
    local addres = add(8, 2)
    print(addres)
    local function sub(number1, number2)
    local subres = number1 - number2
    return subres
    end
    local subres = sub(8, 2)
    print(subres)
    local function div(number1, number2)
    local divres = number1 / number2
    return divres
    end
    local divres = div(9, 3)
    print(divres)
    local function mul(number1, number2)
    local mulres = number1 * number2
    return mulres
    end
    local mulres = mul(9, 4)
    print(mulres)

  • @Lejor
    @Lejor 5 หลายเดือนก่อน +3

    this video was great but i needed my dad to explain what returns were cause prob just for me i didnt know what it was i just knew that it did smt like when i was using returns i didnt understand it took a lot of raging to understand this lol (but thats prob just for me) but dont be sad if you somehow see this because i have spent money on trying to learn but you are showing people how to do it in an understandable way the only thing i can say that is bad is that u get ahead of me while i type but thats not a big problem cause everyone can just pause

  • @hebegebe123
    @hebegebe123 3 หลายเดือนก่อน +2

    Added in an extra subtraction part🤑🤑
    local function subtraction(number1, number2, number3)
    local result = number1 + number2 - number3
    return result
    end
    local printResult = subtraction(8, 2, 9)
    print(printResult)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Output:
    -------------------------------------------------
    18:04:06.295 1 - Server - Functions:7
    ___________________________________________________
    Nice tutorial. Like others, I've always had huge game ideas that I just can't put into work.
    edit: for some reason in the output, youtube thinks "18:04:06" is a timestamp

  • @QanGaming69420
    @QanGaming69420 2 หลายเดือนก่อน

    This coding series is amazing man, keep it up. Here is my coding practice:
    local function multiplication(number1, number2, number3)
    local result = number1*number2*number3
    return result
    end
    local printResult = multiplication(5,5,4)
    print(printResult)
    ----------------------
    local function addition(number1, number2, number3)
    local result = number1+number2+number3
    return result
    end
    local printResult = addition(5,5,5)
    print(printResult)
    -----------------------
    local function subtraction(number1, number2)
    local result = number1 - number2
    print (result)
    end
    local printResult subtraction(11,1)
    ----------------------
    local function division(number1,number2)
    local result = number1/number2
    print (result)
    end
    local printResult division(12,3)

  • @cakeobear
    @cakeobear 6 หลายเดือนก่อน +10

    Can someone help me with Returns? I don't understand what they are meant to mean, and I watched the video and I am still confused, can anybody explain it to me please?

    • @WaldenDexaus
      @WaldenDexaus 5 หลายเดือนก่อน +1

      I searched on the dev forum and it says that returns can stop or give back value after calling the function

    • @Nexdevv
      @Nexdevv 5 หลายเดือนก่อน +1

      i can help you,
      so a return just makes makes the thing return to the function, and you need to use a variable outside of the function to extract it

    • @cakeobear
      @cakeobear 5 หลายเดือนก่อน

      @@Nexdevv tysm

    • @Diezsnuts
      @Diezsnuts 5 หลายเดือนก่อน +2

      @@Nexdevv Pls tell me what “the thing” is I still don't understand ur explanation

    • @Diezsnuts
      @Diezsnuts 5 หลายเดือนก่อน +2

      bruh i still dont understand

  • @Billbo_2
    @Billbo_2 หลายเดือนก่อน

    local function addition(num1, num2, num3)
    local result = num1 + num2 - num3
    return result
    end
    local printresult = addition(8, 24, 9)
    print(printresult)
    this has helped me so much! probably the most intuitive tutorial i have ever seen =)

  • @Kirikaze9
    @Kirikaze9 หลายเดือนก่อน +8

    RIP to all my good ones watching in kindergarten that still haven't learned basic math

  • @alecplayz5552
    @alecplayz5552 11 วันที่ผ่านมา

    After watching the previous 6 episodes of this playlist, I’ve finally decided to sub. Well done! 🎉

  • @goofballer6
    @goofballer6 6 หลายเดือนก่อน +16

    POV: Lil Jimmy getting ready to be a pro but can because he hasn't even reached kindergartner😂

    • @Ismalellel
      @Ismalellel 6 หลายเดือนก่อน +1

      He doesn't even know maths LOL

    • @funfactmaker4924
      @funfactmaker4924 5 หลายเดือนก่อน +4

      @@IsmalellelSo Jimmy,how do you solve two plus two?
      Jimmy : local function Addition(n1,n2)
      local result = n1 + n2
      end
      Addition(2,1)

    • @overanimatetadchon7642
      @overanimatetadchon7642 3 หลายเดือนก่อน +2

      But why he can tho?🤨

    • @Superillness
      @Superillness 2 หลายเดือนก่อน

      does he even know english?

    • @thesillydev382
      @thesillydev382 26 วันที่ผ่านมา

      @@funfactmaker4924 this is why I don’t look at comments😂😂

  • @Stargazer-p5g
    @Stargazer-p5g 13 วันที่ผ่านมา +2

    This is the BEST scripting tutorial I’ve ever watched 10/10 would recommend

  • @emmysparkinglot
    @emmysparkinglot 4 หลายเดือนก่อน +7

    Guys i recommend writing down what you have learned in a (for example) notebook so that it can enter your brain more clearly and so that you can go back if u forgot

    • @AizerzZ
      @AizerzZ 3 หลายเดือนก่อน +2

      I recommend Obsidian program as a huge notebook

    • @DEOgorebox
      @DEOgorebox 2 หลายเดือนก่อน

      Lua is a language that if you have an ordinary brain, you can easily retain knowledge, I learned Lua in 2 evenings with kola and chips

    • @AizerzZ
      @AizerzZ 2 หลายเดือนก่อน

      @@DEOgorebox possible only if you learned like 2harder languages before ngl. Like 2evenings a whole language cmn

    • @Emgurr28
      @Emgurr28 19 วันที่ผ่านมา

      I mean technically Roblox has a note book (The scripts) every time I have a lesson I write the script with the guides and then have the script disabled then place it into a folder where I just look at it if I feel my syntax is wrong.

  • @MIDNITERBS
    @MIDNITERBS หลายเดือนก่อน

    Keep up the great work, this series is really helping me out
    local function addition(number1, number2, number3)
    local result = number1 / number2 * number3
    return result
    end
    local printResult = addition(8, 4, 10)
    print(printResult)

  • @sodaisaziz8512
    @sodaisaziz8512 หลายเดือนก่อน +6

    this was hard to understand

    • @christianjaybasinillo9689
      @christianjaybasinillo9689 29 วันที่ผ่านมา +1

      Yeah because you don't have a basic fundamentals of programming you should learn the basic first making a game is advance not really a beginner, just type in the internet fundamentals of programming
      Its better to learn c first

  • @RobloxClipShorts
    @RobloxClipShorts 4 หลายเดือนก่อน

    I'm already here and I've learned more than anyone has every told & taught me. Thank you so much for the tutorials!

  • @pedrotzexpacial3612
    @pedrotzexpacial3612 หลายเดือนก่อน

    your series is helping me so much that i actually am watching your ads till the end so you can get the full pay, well done

  • @hiitswednesday6319
    @hiitswednesday6319 หลายเดือนก่อน +1

    you explain things so well i understood something that stumped me! thanks!

  • @Naz-v3q
    @Naz-v3q หลายเดือนก่อน

    The return part was really hard to but dumb it down if you don't use the return thing the answer wont come back to you for you to use later , you wont be able to use it later for other things in other scripts if you don't use the return feature. Now you can still technically print it but you will only be able to print it that one time and have to repeat the whole thing again in another script (correct me if I'm wrong)
    local function multiply(number1, number2)
    local result = number1 * number2
    return result
    end
    local printResult = multiply(12, 12)
    print(printResult)
    local function divide(n1, n2)
    local result = n1 / n2
    return result
    end
    local printResult2 = divide(24, 2)
    print(printResult2)

  • @vissyfn
    @vissyfn 2 หลายเดือนก่อน +1

    --Used for organisation
    print("First addition sum. Not using return.")
    local function addition(num1, num2) --Required to work out
    local result = num1 + num2 --Adds num1 & num2
    print(result) --Shows the result of the calculation
    end
    --Gives addition() values to work with
    addition(5, 2)
    addition(5, 4)
    --Used for organisation
    print("Second addition sum. Using return.")
    local function additionv2(number1, number2)
    local result2 = number1 + number2 --Adds the two numbers
    return result2 --Returns the answer of the two numbers
    end
    local printResult = additionv2(8, 2) --Defines addition2()
    print(printResult) --Prints the result of addition2()
    -- return can also be used to exit out of functions, which means that it can end the function at whatever line it is called.
    --Used for organisation
    print("First subtraction sum. Using return.")
    local function subtractrion(sub1, sub2)
    local resultOfSub = sub1 - sub2 --Subtracts the two numbers
    return(resultOfSub) --Returns the result of the subtraction
    end
    local subResult2 = subtractrion(34, 32) --Defines subtraction()
    print(subResult2) --Shows the results of the subtraction
    local subResult = subtractrion(65, 32) --Defines subtraction()
    print(subResult) --Shows the results of the subtraction
    --Used for organisation
    print("Second subtraction sum. Not using return.")
    local function subtraction2(subnum1, subnum2)
    local resultOfSub2 = subnum1 - subnum2 --Subtracting subnum1 & subnum2
    print(resultOfSub2) --Shows the result of this subtraction
    end
    --Numbers to be used for subtraction.
    subtraction2(86, 32)
    subtraction2(32, 68)
    --One thing I noticed is that trying to do many sums using return is alot more code writing and work than just doing:
    --local function addition(num1, num2)
    -- local result = num1 + num2
    -- print(result)
    --end
    --addition(5, 2)
    --addition(5, 4)
    --Because you have to do local subtraction = subtraction(54, 56)
    -- print(subtraction)
    --every single time for each number instead of just doing subtraction(43, 64)

  • @B0MSH1K
    @B0MSH1K 2 หลายเดือนก่อน

    I did this, also thank you for making these tutorials that actually work.
    local function addition(number1, number2)
    local additionresult = number1 + number2
    return additionresult
    end
    local printResult = addition(8, 2)
    print(printResult)
    local function subtraction(num1, num2, num3)
    local subtractionresult = num1 - num2 - num3
    return subtractionresult
    end
    local printsubtractionresult = subtraction(3, 19, 5)
    print(printsubtractionresult)
    local function multiplication(num1, num2, num3, num4)
    local multiplicationresult = num1 * num2 * num3 * num4
    return multiplicationresult
    end
    local printmultiplicationresult = multiplication(5, 10, 16, 8)
    print(printmultiplicationresult)

  • @oxerful5426
    @oxerful5426 2 หลายเดือนก่อน

    I was having some trouble with your explanation of return statements, but I got it down in the end :D Great tutorial again

  • @SQUIP_AND_SQUIB
    @SQUIP_AND_SQUIB 17 วันที่ผ่านมา +1

    THIS IS AN AMAZING SCTIPTING TUTORIAL IM GOING TO WATCH THE BEGGINERS, ADVANCED, AND GUI!!!!!!!

  • @MrToastGHG
    @MrToastGHG 3 หลายเดือนก่อน

    ty for doing this content cause its so much better then from other people cause u give like homework which realy helps with the learning (this episode was hard)

  • @lookitsadrian
    @lookitsadrian 2 หลายเดือนก่อน

    i've been watching these videos and at first it was hard to follow until i found a way to focus. i play my favorite music in the background which at first might seem distracting, but for me its helpful since i an associate your awesome videos to me vibing lol

  • @trippy2910
    @trippy2910 3 หลายเดือนก่อน

    im seriously learning thank you, if you change the numbers the script at the bottom works to change the print :)
    local result = number1 - number2
    return result
    end
    local function division(number1, number2)
    local result = number1 / number2
    return result
    end
    local function multiplication(number1, number2)
    local result = number1 * number2
    return result
    end
    local printResult = addition(8, 2) + subtraction(5, 10) + division(10, 2) + multiplication(9, 10)
    print(printResult) if printResult == 100 then
    print("YAY!")
    else
    print("Womp womp")
    end

  • @AL3XPLAYSRBLX
    @AL3XPLAYSRBLX 2 หลายเดือนก่อน

    Wow this is just, amazing
    My friend has spent a week learning everything from episodes 1-8 and I’m here doing it in under an hour 😂

  • @nonplex
    @nonplex หลายเดือนก่อน

    That return function got me so confused, lol. Thanks for the tutorial here's the code I wrote!
    local function Addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult = Addition(8, 2)
    print(printResult)
    local function Subtraction(number1, number2, number3)
    local result = number1 - number2 - number3
    return result
    end
    local subtractionResult = Subtraction(10, 5, 2)
    print(subtractionResult)
    local function Multiplication(number1, number2)
    local result = number1 * number2
    return result
    end
    local MultiplicationResult = Multiplication(5, 20)
    print(MultiplicationResult)
    local function Division(number1, number2)
    local result = number1 / number2
    return result
    end
    local DivisionResult = Division(15, 3)
    print(DivisionResult)

  • @aaaaaaaaaaaawda
    @aaaaaaaaaaaawda 2 หลายเดือนก่อน

    I used to struggle learning coding, but i learned python and then tried roblox coding again n it was way easier! i kinda already know these basics so im speeding through them but still a great video!
    .
    .
    script:
    local function addition(num1, num2)
    local result = num1 + num2
    return result
    end
    local function subtraction(num1, num2)
    local result = num1 - num2
    return result
    end
    local function multiplication(num1, num2)
    local result = num1 * num2
    return result
    end
    local function division(num1, num2)
    local result = num1 / num2
    return result
    end
    print(addition(2, 4))
    print(subtraction(4, 5))
    print(multiplication(2, 5))
    print(division(5, 2))

  • @RNC-o6u
    @RNC-o6u 3 หลายเดือนก่อน +1

    This helped a lot, this is what I got for my code:
    local function Division(num1, num2, num3)
    local result = (num1 / num2) + num3
    return result
    end
    local printResult = Division(8, 2, 4)
    print(printResult)
    local function Subtraction(num10, num9, num8, num7)
    local answer = (num10 - num9 - num8) / num7
    return answer
    end
    local AnswerResult = Subtraction(8, 2, 4, 2)
    print(AnswerResult)

  • @milolokk6274
    @milolokk6274 4 หลายเดือนก่อน

    ive tried leaning many coding languages and ive never understood what a return statement was in any of them thank you for explaining really well these are prob the best coding tuts out there
    function opacity(x,y)
    baseplate.Transparency = 0.5
    wait(1)
    baseplate.Transparency = 0
    wait(1)
    baseplate.Transparency = 0.5
    wait(1)
    baseplate.Transparency = 1

    print(x, y)
    end
    i finally understand what a return statement does
    edit( ) an idea i had with this
    local function health(health,damage)
    local res = health - damage
    return res
    end
    local takendamage = health(100,45)
    print(takendamage)
    can be used for damage being taken in by a character i dont know if theres a more simple way but this is how i saw it

  • @H-nl9ub
    @H-nl9ub หลายเดือนก่อน

    man tysm for the guides,this really helps me ur the best!
    local function addition(number1,number2)
    local result = number1 + number2
    if result == 6 then print("this is equal to 6!")
    elseif result == 4 then print ("this is equal to 4!")
    end
    end
    addition(2,4)
    addition(1,3)

  • @rensuakatimechi
    @rensuakatimechi 4 หลายเดือนก่อน

    local function addition(number1, number2)
    local result = number1 + number2
    return result --What does return do? So return is the results of the caculations we made back to where we called the function
    end
    -- we can create a variable to attach to the function so we can take the value and print it ourselves out side of the function
    local printResult = addition(8, 2) -- once the two numbers or values are added it restuns the results back into our own statement
    print(printResult)-- we created a variable out side and set the sequal = values to addition with the 2 numbers then the two numbers are added then then return brought back the results to printResults
    --"return" can also be use to exit out of functions, which means that it can end the function whenever the line it is called and the rest of the function will NOT run

  • @JDRS_A
    @JDRS_A หลายเดือนก่อน +2

    Happy new year lol

  • @AverageRobloxKid69
    @AverageRobloxKid69 หลายเดือนก่อน

    honestly thank you man in the past i could hardly grasp the concept of even trying to code but this helped me so much here is my simple code i made:
    local function addition(number1, number2, number3)
    local result = number1 * number2 - number3
    return result
    end
    local printResult = addition(8, 2, 6)
    print(printResult)

  • @susguy_yk7430
    @susguy_yk7430 หลายเดือนก่อน

    Hey! I don't know if anyone here is active since these videos was posted 5 months ago.. But I'd like to tell the people that are also learning Lua script codelanguage (Just like me) that if u sit and stare at a code and try to understand what all the yapping and words are for and what they mean. Copy or write down the code on your pc and paste it on ChatGPT and ask the robot what all the words are telling you or what they do! This helped me ALOT. Make sure (only if u need) to ask the Bot to adapt the language to the way only YOU understand it so it gets easier! That also really helped me as i got language disorder and adhd. But take care guys i love helping (if this even helped or did i just yap for nothing😭🙏🏽)

  • @Lilisa33
    @Lilisa33 4 หลายเดือนก่อน +2

    can I ask, whats the point of the "return" command, when it seems like it didnt really do anything to the code?

  • @ddork13
    @ddork13 29 วันที่ผ่านมา +1

    local function subtraction(number40, number32)
    local result = number40 - number32
    return result
    end
    local printresult = subtraction(40, 32)
    print(printresult)
    local function addition(number30, number28)
    local result = number30 + number28
    return result
    end
    local printresult = addition(30, 28)
    print(printresult)
    local function division(number45, number9)
    local result = number45 / number9
    return result
    end
    local printresult = division(45, 9)
    print(printresult) haha good videos bro!

  • @Desnoper091
    @Desnoper091 2 หลายเดือนก่อน

    I’ve searched for so many tutorials, and I didn’t find any good ones but then I found this tutorial it is so good +1 sub

  • @vvkiivv
    @vvkiivv 5 หลายเดือนก่อน

    local function addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local printResult1 = addition(8, 2)
    print(printResult1)
    local function subtraction (number1, number2)
    local result = number1 - number2
    return result
    end
    local printResult2 = subtraction(10, 5)
    print(printResult2)
    local function multiplication(number1, number2)
    local result = number1 * number2
    return result
    end
    local printResult3 = multiplication(10, 10)
    print(printResult3)
    local function division(number1, number2)
    local result = number1 / number2
    return result
    end
    local printResult4 = division(1000, 100)
    print(printResult4)
    Your tutorials are really helpful and you explain them really well thanks

  • @jochua9793
    @jochua9793 19 วันที่ผ่านมา +2

    Tried to use both :]
    local function addition(n1, n2)
    local result = n1 + n2
    return result
    end
    local x = addition(10, 4)
    local y = addition(2, 15)
    local z = addition(2, 98)
    local a = addition(71, 9)
    local function operation(x, y, z, a)
    local result = ((x+y)^z)*a
    print ("Your value is", result)
    end
    operation(x, y, z, a)

  • @SuperBenBoy5886
    @SuperBenBoy5886 13 วันที่ผ่านมา +1

    I've been trying to learn roblox scriping fundamentals on-and-off over the past 3 years and return is something I have STILL YET to understand. Someone please help me.

  • @SaimonasMartinkus
    @SaimonasMartinkus หลายเดือนก่อน

    we need more people like you :)
    local function multiply(num1, num2, num3, num4)
    local multynum1andnum2 = num1 * num2
    print(multynum1andnum2)
    local divinum1andnum2 = num3 / num4
    print(divinum1andnum2)
    end
    multiply(4, 12, 86, 3)

  • @Ben_the_thing
    @Ben_the_thing 18 วันที่ผ่านมา

    Thanks for the help or more like tutorial :)
    local function car(n1, n2, n3, n4)
    local result = n1 + n2 - n3 / n4
    return result
    end
    local printresult = car(12, 13, 6, 3)
    local function honk(num1, num2, num3)
    local resultet = num1 * num2 - num3
    return resultet
    end
    local madam = honk(26, 23, 12)
    local function clonk(number1, number2, number3, number4, number5)
    local agrement = number1 * number2 *number3 * number4 * number5
    return agrement
    end
    local skip = clonk(10, 10, 10, 10, 10)
    print(printresult)
    print(madam)
    print(skip)

  • @iimonstergames8039
    @iimonstergames8039 26 วันที่ผ่านมา

    so what i learned is
    local yesYE = 13 + 19
    print(yesYE)
    local function addition(num1, num2)
    local result = num1 + num2
    return result
    end
    local printResult = addition(13, 19)
    print(printResult)
    so thank you i swear this is the best series for scripiting i learned alot tysm

  • @CaspherRosales-g2i
    @CaspherRosales-g2i หลายเดือนก่อน

    The way I understand it, the `return` statement is used to make a script more reusable and efficient. Instead of rewriting the same code for different parts of the game, I can just create a function with a `return` and call that function whenever I need it. This saves me time and keeps my code organized. If I need to change how something works, I only have to update the function in one place, and it will automatically update everywhere it's used. It makes things easier to manage and reduces mistakes.

  • @ChipiChipiKAYRA
    @ChipiChipiKAYRA 5 หลายเดือนก่อน +1

    Thanks :D I will do special thanks you in my experience :D

  • @erwin-f5b
    @erwin-f5b 5 หลายเดือนก่อน

    i have always loved scripting , i started with java , but i didnt see a future with making games in java. java compared to this is super super complicated , i didnt really belive how simple luau actually is. to be honest i think i had a really big advantage from other people starting with luau since some things are semmilar to java , like funktions and variables. i was always really confused by other youtube videos , since they put stuff that is absolutly not for beginners. i love how you explain pretty much everything , even how to rename the scripts and how to add them every single time xD. Love your videos , dont stop! :]

  • @Idont_eatcrocs
    @Idont_eatcrocs 28 วันที่ผ่านมา

    These have to be one or the best roblox scripting tutorials on the TH-cam. thank you so much for making game development easier

  • @ushouston633
    @ushouston633 3 หลายเดือนก่อน

    i wasnt as cool in mine, but i took alot of notes
    local function addition(number1, number2, number3) --[inside parenthesis are our parameters]
    local result = number1 + number2 - number3
    return result
    end
    -- return statements return the value
    local printResult = addition(10, 20, 15) -- adds variable to number1, number2 by using "addition()"
    print(printResult) -- print actually executes the command
    --[[ difference in arguments and parameters are that parameters are
    what we use to create our variables inside of the parenthesis
    (function caluclation) and the stuff below is the calcuations
    the argument is what values we throw into the function]]

  • @ShadowX_z
    @ShadowX_z หลายเดือนก่อน

    wow im learning so much ty
    my script-
    local function addition(number1, number2)
    local result = number1 + number2
    return result
    end
    local pResult = addition(1, 2)
    print(pResult)
    local function subtraction(ee1, ee2)
    local sres = ee1 - ee2
    return sres
    end
    local eresult = subtraction(10, 5)
    print(eresult)

  • @soudeux8702
    @soudeux8702 2 หลายเดือนก่อน +1

    i think i got return, if u didnt, imagine that "local VariableReturn = function(1, 1)" will execute and read the function, once he finds the "return", it will return the variable u want to, and finish reading it, so VariableReturn = result

  • @soyyoluca5248
    @soyyoluca5248 4 หลายเดือนก่อน

    local function velocity(distance, time)
    local result = distance * time
    return result
    end
    print(velocity(4, 10))
    a little something i remembered from physics class. thanks for the class!

  • @marsko9937
    @marsko9937 หลายเดือนก่อน

    local function acoolfunction(number1, number2)
    local answer = number1 - number2
    return answer
    end
    local show_ans = acoolfunction(86, 79)
    print(show_ans)
    this is a cool tutorial!
    thank you!

  • @oliveirapy
    @oliveirapy 20 วันที่ผ่านมา +1

    so heres a way to understand return
    local function addition(n1, n2)
    result = n1 + n2
    return result
    end
    print(addition(1,2))
    -- the function gets two parameters n1 and n2
    -- the function adds them together as numbers and returns a result value
    -- we print the result value just by putting the function inside the print statement with the n1 and n2 values
    i hope it helps someone if it do so like the comment so it reaches more ppl

  • @MrmangaCP
    @MrmangaCP 2 หลายเดือนก่อน

    Yo TY so much for this series my mum mentioned my cousins started so now we having a competition on who can get most players and this series is helping me learn

  • @EliCool-g1h
    @EliCool-g1h 3 หลายเดือนก่อน

    I love how you teach scripting because most people teach scripting real boring so thank you so much and this is what I did!
    local function plusUltra(number1, number2)
    local answer = number1 + number2
    return answer
    end
    local printAnswer = plusUltra(7, 3)
    print(printAnswer)
    print("minus")
    local function minusUltra(number1, number2)
    local answer = number1 - number2
    return answer
    end
    local printAnswer = minusUltra(10, 5)
    print(printAnswer)
    print("equals 5")

  • @baasb-v7j
    @baasb-v7j 16 วันที่ผ่านมา

    thanks for helping me understand scripting on roblox i wanted to try and learn it forever but this tutorial is the first one that makes me understand it. +1 sub!!

  • @Hivedbutyoutube
    @Hivedbutyoutube หลายเดือนก่อน +1

    I dont realy get why you would need to do return tho if you could just do
    (5, 2) since its more simple or is the return like a fixed value that always stays the same in case you forget the numbers or something.

    • @Hivedbutyoutube
      @Hivedbutyoutube หลายเดือนก่อน

      Wait I think I get it know but correct me if I'm wrong, is it just a thing you can do to save time (since I realised that local printResult = addition(8, 2) is longer

  • @mato8816
    @mato8816 3 หลายเดือนก่อน

    the fact that anyone can learn with your video is amazing

  • @ManoramaAdiga
    @ManoramaAdiga 3 หลายเดือนก่อน

    You deserve to have way way more subs. Congratulations you got +1 sub😊

  • @shajidhossain9361
    @shajidhossain9361 5 หลายเดือนก่อน

    Yo I was just gonna say this map concept is really cool and all these concepts are sick. But I was just gonna ask of what the practical use for math would be inside of our scripts?

  • @srcgisrealwow
    @srcgisrealwow 5 หลายเดือนก่อน

    local function addition(num1, num2, num3, num4, num5)
    local result = num1 * num2 * num3 * num4 * num5
    return result
    end
    local printResult = addition(8, 4, 10, 56, 701)
    print(printResult)
    ur the best man keep up the good work!!

  • @Joeyz2
    @Joeyz2 หลายเดือนก่อน +1

    local function addition(number1, number2, number3, number4)
    local result = number1 * number2 + number3 / number 4
    return result
    end
    local printresult = addition(21, 8, 5, 7)
    print(printresult)

  • @KindBloom100
    @KindBloom100 5 หลายเดือนก่อน

    it is easy for me to follow along with your guide but the thing is that i keep forgetting, so what i want to tell everyone who also forgets is to just keep doing more learning objectives

  • @blixxy-d5j
    @blixxy-d5j วันที่ผ่านมา

    Thanks for teaching us . My Homework is given below.
    local function addition(n1, n2)
    local result = n1 + n2
    return result
    end

    local printresult = addition(1000,1000)
    print(printresult)

    local function subtraction(n1, n2, n3)
    local result = n1 - n2 - n3
    return result
    end
    local printresult = subtraction(10000,5000,1000)
    print(printresult)


    local function multiplication(n1, n2)
    local result = n1 * n2
    return result
    end
    local printresult = multiplication(1000,1000)
    print(printresult)


    local function division(n1, n2)
    local result = n1 / n2
    return result
    end
    local printresult = division(10000, 10000)
    print(printresult)


    local function multidivi(n1, n2, n3)
    local result = n1 * n2 / n3
    return result
    end
    local printresult = multidivi(1000, 1000, 500)
    print(printresult)

  • @camilaliyev4041
    @camilaliyev4041 9 วันที่ผ่านมา +1

    is writting anything after return is incorrect like it does nothing right bc after result it ends?

  • @EugescoJuve10
    @EugescoJuve10 4 หลายเดือนก่อน

    local function maths(n1, n2, n3)
    local result = n1 + n2 * n3
    print(result)
    end
    maths(7, 10, 29)
    Wanted to keep it easy, love your videos!

  • @JustEvanC
    @JustEvanC หลายเดือนก่อน +1

    local function MoreAddition (number1, number2)
    local result = number1 / number2
    return result


    end
    local printedresult = MoreAddition(10,2)
    print(printedresult)
    --But wouldn't this work just fine as well? (check the last 2 lines on both the codes to find the difference
    local function MoreAddition (number1, number2)
    local result = number1 / number2
    return result


    end
    print(MoreAddition(10,2))

  • @SebastianBraate
    @SebastianBraate 10 วันที่ผ่านมา +1

    it just feels like alot of usless variables.... can anyone please explain why.

  • @lucid.r61
    @lucid.r61 4 วันที่ผ่านมา

    this is what i learned :D
    local function addition(num1,num2,num3,str1)
    local result = num1+num2*num3..str1
    return result
    end
    local printResult = addition(1,3,2," testing")
    print(printResult)

  • @TheRealLTRCF
    @TheRealLTRCF 3 หลายเดือนก่อน +1

    I couldnt understand how to use different uhh whatever its called to like add and subtract u know
    local function addition(number1, number2, number3)
    local result = number1 + number2 + number3
    return result
    end
    local printResult = addition(24, 98, 12)
    print(printResult)
    local function subtraction(number1, number2, number3)
    local result = number1 - number2 - number3
    return result
    end
    local printResult = subtraction(24, 98, 12)
    print(printResult)
    local function multiplication(number1, number2, number3)
    local result = number1 * number2 * number3
    return result
    end
    local printResult = multiplication(24, 98, 12)
    print(printResult)
    local function division(number1, number2, number3)
    local result = number1 / number2 / number3
    return result
    end
    local printResult = division(24, 98, 12)
    print(printResult)