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

  Рет қаралды 45,467

BrawlDev

BrawlDev

Күн бұрын

DISCORD 📜
Join my Discord Community if you want scripting help, participate in events/challenges, and make friends!
/ discord
MEMBERSHIPS 🎁
Get Access To My Scripts + More Perks By Becoming a Channel Member! 👇
/ @brawldevrblx
BEGINNER ROBLOX SCRIPTING SERIES 🟢
• Roblox Beginners Scrip...
ROBLOX GUI TUTORIAL SERIES 🎨
• Roblox GUI Tutorial Gu...
ADVANCED ROBLOX SCRIPTING SERIES 🔴
• Roblox Advanced Script...
TWITTER / X 🐦
/ brawlbattlerblx
In this NEW 2024 Guide to Roblox Scripting for Beginner Developers, I will go through everything you need to know to continue scripting on Roblox!
My new mission is to have fun teaching everything I know from developing games on Roblox since 2016. We will dive into scripting concepts as basic as printing to as complicated as raycasting. For every episode of this series, I encourage you to do everything I do to gain experience and let it stick with you so that you can create the games you're passionate about on your own. Enjoy this series and remember: being a competent scripter takes time and effort so don't get discouraged if things get too tricky. Remember where your inspirations came from; if you can be a Roblox scripter, then anyone can!
Tags:
#roblox #robloxstudio #robloxscript #robloxscripting #robloxadvancedscripting #robloxdev #robloxdevelopment #robloxdeveloper #robloxprogramming #scripting #programming #gamedev #gamedevelopment #gamedeveloper #robloxtutorial #robloxscriptingtutorial #howtomakeagameonroblox #robloxhowto #robloxcoding #coding #codingtutorial #codingtutorials #foryou
DOWNLOAD ROBLOX STUDIO HERE:
create.roblox.com
(On the left side under "Quick Links", click on "Studio" and download)

Пікірлер: 606
@VoltigarRBLX
@VoltigarRBLX 2 ай бұрын
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 2 ай бұрын
Agreed, Agreed, and Agreed
@Thefourdelinquents-q6b
@Thefourdelinquents-q6b 2 ай бұрын
Yeah like I wanna make games but it’s just hard for me to watch so much tutorials until I get it
@jfeondkthz
@jfeondkthz Ай бұрын
holy glaze 🙏
@VoltigarRBLX
@VoltigarRBLX Ай бұрын
@jfeondkthz pretty exclusively constructive feedback, but I guess in circles where there's exclusively insecure men you can't even compliment each other or give feedback without people reading it some kinda weird way
@Demonsinful
@Demonsinful Ай бұрын
​@@VoltigarRBLX I mean he is kinda glazing the man
@summeranan6969
@summeranan6969 2 ай бұрын
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
@Boop_your_nose
@Boop_your_nose 2 ай бұрын
The script that I made. Thank you for the amazing tutorials! local function addition(number1, number2) local result = number1 + number2 return result end local printResult = addition(8, 2) -- This is for adding numbers print(printResult) local function subtraction(number1, number2) local result = number1 - number2 return result end local printResult = subtraction(8, 2) -- This is for subtracting numbers print(printResult) local function division(number1, number2) local result = number1 / number2 return result end local printResult = division(8, 2) -- This is for dividing numbers print(printResult) local function multiplication(number1, number2) local result = number1 * number2 return result end local printResult = multiplication(8, 2) -- This is for multiplying numbers print(printResult)
@fantomgaming1358
@fantomgaming1358 Ай бұрын
how is the script supposed to tell which printResult it should print when all their keynames are the same?
@Boop_your_nose
@Boop_your_nose Ай бұрын
@@fantomgaming1358 it prints them all regardless of the same name, although I should've changed the key name.
@fantomgaming1358
@fantomgaming1358 Ай бұрын
@@Boop_your_nose yeah
@jacetheace55
@jacetheace55 Ай бұрын
i made it so that if the print result is not equal to 4 it prints "AAAAAA" and if it is it just prints the result, which is 4 pretty useless tbh because there's really no point in printing the correct result because whatever you set the result to will always be equal to itself.
@mayineverfalter
@mayineverfalter 4 ай бұрын
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 3 ай бұрын
TYSM you just saved me 13 mins!
@pinkofthedude
@pinkofthedude 2 ай бұрын
@@polegamerstv7035 No he didnt, just having that script isnt gonna help you learn anything.
@aMysterious1rblx
@aMysterious1rblx 2 ай бұрын
we have the same profile picture
@EdwardEnglish-j2h
@EdwardEnglish-j2h 2 ай бұрын
*head banging on desk* *gets concussion* My brain: thATs WhaT i hAVe tO dOoooOOoooooo? I DONT WANNA Proceeds to get brain damage
@polegamerstv7035
@polegamerstv7035 2 ай бұрын
@@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
@saikonick8312
@saikonick8312 15 күн бұрын
most of your vids have the same views, that means that you make ppl be happy to learn coding! Be proud of that!
@OnePiece_Dimension
@OnePiece_Dimension 28 күн бұрын
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 14 күн бұрын
I love how this isn’t even confusing to me anymore after this video
@RSM_ONION
@RSM_ONION Ай бұрын
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"
@faintvolley
@faintvolley Ай бұрын
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)
@Blood-StrikeGamer
@Blood-StrikeGamer 3 ай бұрын
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.
@osakadev
@osakadev 4 ай бұрын
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 4 ай бұрын
Modulus
@osakadev
@osakadev 4 ай бұрын
@@BedwarsRBLX true
@s1nblitz
@s1nblitz 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 4 ай бұрын
@@s1nblitz Those are compound operators, not math operators, I'm talking about math operators
@CrackedUpEgg
@CrackedUpEgg 2 ай бұрын
mine: rad (radius i think) pi circumference sin square root ratio abs (absolute) (Length from zero) cosine round >.
@daniel_denamit724
@daniel_denamit724 3 ай бұрын
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!
@korudo855
@korudo855 2 ай бұрын
you think youd be able to elaborate it?
@ioproto6581
@ioproto6581 2 ай бұрын
​@@korudo855 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 2 ай бұрын
@@korudo855 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.T724
@E.T724 Күн бұрын
@@BruhEditsFr ooo i see now, but how is it different from using the arguments. Like is it better to use?
@sereneybeanie6733
@sereneybeanie6733 23 күн бұрын
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)
@SimplyTutuco
@SimplyTutuco Ай бұрын
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 Ай бұрын
Wdym ,It returns the local function I think you need a dictionary it's literally straight forward.
@V4x07
@V4x07 Ай бұрын
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
@Bananacease69
@Bananacease69 22 күн бұрын
wow nice, this is so cool
@Roman_play012
@Roman_play012 21 күн бұрын
it doesn't actually work, i copied to test and it showed me "you died" before even dying
@python5248
@python5248 17 күн бұрын
Hmm that's prolly bcus the variable hpLeft prolly went in decimals so smth like If hpLeft
@avishyyakobov
@avishyyakobov 14 күн бұрын
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 14 күн бұрын
@@avishyyakobov Yooo my code works? Dats so cool thnx🔥🔥🔥
@planktonuser660
@planktonuser660 6 күн бұрын
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
@Emiwithlittlecreativity
@Emiwithlittlecreativity 26 күн бұрын
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 15 күн бұрын
I recommend Obsidian program as a huge notebook
@zoid_ws1226
@zoid_ws1226 3 ай бұрын
I see that python and luau are very similar in some aspects so I was able to understand most of the video before you explained it. Still very good explained video! Anyway here is the code I learnt from this epsioide! local function addition(x,y) local result = x + y return result end local printresult = addition(5,4) print(printresult) local function Minus(x,y) local result = x - y return result end local result2 = Minus(10,9) print(result2) local function Multipication(x,y,z) local result = x * y * z return result end local result3 = Multipication(20,10,3) print(result3) local function Division(x,y) local result = x / y return result end local result4 = Division(100,10) print(result4) local function bidmass(w,x,y,z) local result = w + x / y * z return result end local result5 = bidmass(10,20,400,5) print(result5)
@Sk_lled
@Sk_lled Ай бұрын
Yeah, I'm just starting this and I've done basic python and know most of this
@Life_of_Boredom
@Life_of_Boredom 2 ай бұрын
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 Ай бұрын
Omg you just saved me another 1 or 2 days trying to figure this out ty!!!
@Capy5687
@Capy5687 Ай бұрын
It took all of my braincells to understand this concept
@nyanay0
@nyanay0 Ай бұрын
the next line is "end"
@liviii4188
@liviii4188 Ай бұрын
so the return statement lets you use the result of a function elsewhere in your code without repeating the calculations?
@Contemptical
@Contemptical Ай бұрын
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
@RNC-o6u
@RNC-o6u 4 күн бұрын
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)
@vali0us
@vali0us 9 күн бұрын
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.
@vvkiivv
@vvkiivv 2 ай бұрын
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
@ManoramaAdiga
@ManoramaAdiga Күн бұрын
You deserve to have way way more subs. Congratulations you got +1 sub😊
@rensuakatimechi
@rensuakatimechi 24 күн бұрын
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
@questionmarkdude4910
@questionmarkdude4910 26 күн бұрын
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)
@cakeobear
@cakeobear 2 ай бұрын
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 2 ай бұрын
I searched on the dev forum and it says that returns can stop or give back value after calling the function
@Nex_Devs
@Nex_Devs 2 ай бұрын
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 2 ай бұрын
@@Nex_Devs tysm
@mopmopmoo7671
@mopmopmoo7671 2 ай бұрын
@@Nex_Devs Pls tell me what “the thing” is I still don't understand ur explanation
@JesseMinecraftXD
@JesseMinecraftXD 2 ай бұрын
@@Nex_Devs Clarification (for myself): In order to actually get a result as a variable from a function you need to use a return. The return is essentially the "finished product" of the function? And from there you can set a variable to that return and extract said finished product?
@vmc-mal
@vmc-mal 3 ай бұрын
Another decent one, here's my learning objective. --No Return local function calcButOnlyAddition(num1, num2) local result = num1 + num2 print(result) end calcButOnlyAddition(100, 100) calcButOnlyAddition(37, 32) --WithReturn local function calcButWithAdditionAndResult(num1, num2) local result = num1 + num2 return result end local result = calcButWithAdditionAndResult(37, 32) print(result) local result = calcButWithAdditionAndResult(100, 100) print(result)
@RobloxClipShorts
@RobloxClipShorts 27 күн бұрын
I'm already here and I've learned more than anyone has every told & taught me. Thank you so much for the tutorials!
@ump7732
@ump7732 2 ай бұрын
Thank you for making these, it has made learning scripting easier local function addition(n1, n2) local result = n1 + n2 print(result) return result end local printresult = addition(6, 9) print(printresult) local function subtraction(n3, n4) local result2 = n3 - n4 print(result2) return result2 end subtraction(5, 5)
@IAmALime
@IAmALime 3 ай бұрын
local RP = game.Workspace.RedPart local function sigma() RP.Transparency = 0.5 end sigma() sigma() i repeated this with a couple other things such as anchoring and materials :D loved the video!
@srcgisrealwow
@srcgisrealwow 2 ай бұрын
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!!
@milolokk6274
@milolokk6274 Ай бұрын
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
@TFS-o8j
@TFS-o8j 11 күн бұрын
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")
@Timuçinn1
@Timuçinn1 2 ай бұрын
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
@BillyBob-ki1uf
@BillyBob-ki1uf 2 күн бұрын
SCRIPT: local function addition(n1, n2, n3) local result = n1 + n2 / n3 return result end local function subtraction(n1, n2, n3) local result = n1 - n2 / n3 return result end local result0 = addition(7, 3, 1) local result1 = addition(7, 14, 2) local result2 = subtraction(5, 15, 3) print(result0) print(result1) print(result2) OUTPUT: " 10 14 0 " KZbin COMMENT: This series just chefs kiss. I have gotten tired of being limited to 'building' Roblox games and I cannot explain how cool this is to actually be working, experimenting and using scripts in Studio. Thank you BrawlDev :)
@hebegebe123
@hebegebe123 3 күн бұрын
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
@Localally
@Localally 3 ай бұрын
local function PEMDAS(num1, num2, num3, num4, num5) local Sum = num1 + num2 * num3 - num4 / num5 return Sum end local PrintSum = PEMDAS(5, 5, 2, 4, 2) print(PrintSum) end something small and loving the series so far, easy to understand, and well paced
@ushouston633
@ushouston633 10 күн бұрын
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]]
@Guest_Apex
@Guest_Apex 3 ай бұрын
great video! local function subtraction (letter1, letter2) local result = letter1 - letter2 return result end local printResult = subtraction(4, 3) print(printResult)
@EugescoJuve10
@EugescoJuve10 Ай бұрын
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!
@Sof_Holl
@Sof_Holl 3 ай бұрын
the start: local addition = 2 + 4 print(addition) local addition2 = 2 * 4 print(addition2) local adddition3 = 4 / 2 print(adddition3) the end: local function addition(number1, number2) local result = number1 * number2 return result end local printResult = addition(8, 2) print(printResult) local function addition(number1, number2) local result = number1 - number2 return result end local printResult = addition(8, 2) print(printResult) local function addition(number1, number2) local result = number1 / number2 return result end local printResult = addition(8, 2) print(printResult) tysm :)
@CraftedConnections
@CraftedConnections 3 ай бұрын
0:28 little Timmy : aw! I can’t make my super cool lighting McQueen obby anymore😢😢😢 I don’t know Aditwon!
@bloblets
@bloblets 22 күн бұрын
rip lil noobert
@eclipse00992
@eclipse00992 2 ай бұрын
local function subtraction(num1, num2, num3) local realResult = num1 - num2 - num3 return realResult end local printResult = subtraction(10, 5, 3) print(printResult) wonderful episode!
@zephyr_playz2535
@zephyr_playz2535 3 ай бұрын
I am a bit confused so I will try to practice these first 7 episodes before moving on! Thanks for all of the help though, this is such a lifesaver.
@erwin-f5b
@erwin-f5b 2 ай бұрын
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! :]
@mr.chromo
@mr.chromo 2 ай бұрын
This one definitly slowed me down a bit, and while I'm left a little confused I was able to replicate it first try with subtraction...now...for the notes ()()()()() NOTES ()()()()() 1 local addition = 2+2 2 print + (addition) ________________________ That should print out 4 in the output ________________________ 1 local function addition(number1, number2) 2 local result = number1 + number 2 3 print (result) 4 end 5 6 addition (5, 2) _________________________________________ That should output 7 _________________________________________ Return _________________________________________ 1 local function addition (number1, number2) 2 local result = number1+ number2 3 return result 4 end 5 6 local printResult = addition (8, 2) 7 print (printResult) ---------------------------------------------------------------- Learning objective: Make more functions for things like subtraction and division ----------------------------------------------------------------- Attempt _______________________________________ local function subtraction(number1, number2) local result = number1 - number2 return result end local printResult = subtraction(8, 4) print(printResult)
@ChipiChipiKAYRA
@ChipiChipiKAYRA Ай бұрын
Thanks :D I will do special thanks you in my experience :D
3 ай бұрын
local function addition(number1, number2) -- Paremeter is basically a variable we only define when calling the function. local result = number1 + number2 return result -- Return is returning whatever the result was too where the function was called, can also stop executions in functions. end local printResult = addition(8, 2) print(printResult) local function substraction(number1, number2) local result = number1 - number2 return result end local printResult = substraction(6, 3) print(printResult)
@ManoramaAdiga
@ManoramaAdiga Күн бұрын
Local function addition (number1 + number2) Local result = number1 + number2 return result End Local printResult = addition(5, 5) print(printResult) will equal to 10
@soyyoluca5248
@soyyoluca5248 Ай бұрын
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!
@vishwakarmakaushal259
@vishwakarmakaushal259 Ай бұрын
local function addition(num1, num2, num3) local result = num1 * num1 * num3 return result end local x = addition(3.14, 2, 2) print("A circle has radius 2cm find area of circle") print("answer is :") print(x)
@calluss1
@calluss1 2 ай бұрын
Thanks again, here's the script I made, i know its not much but i tried local function subtraction(number1, number2, number3) local result = number1 - number2 - number3 return result end local printResult = subtraction(100, 50, 25) print(printResult) Outcome = 25
@qw0lzz418
@qw0lzz418 21 күн бұрын
--confused little bit but i will return and try to understand again later local function matam(naga1, naga2) local result = naga1 + naga2 return result end local printResult = matam(8, 2) print(printResult)
@shajidhossain9361
@shajidhossain9361 Ай бұрын
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?
@IceyDude1
@IceyDude1 2 ай бұрын
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 Ай бұрын
Agree
@TarekTRBW
@TarekTRBW Ай бұрын
Attractive homework bro needs to be teacher
@eljaitor8558
@eljaitor8558 Ай бұрын
that's adds all of the things that learm in the video ;) local function addition (number1, number2) local resultAddition = number1 + number2 return resultAddition end local printresultaddition = addition(2, 1) --for example print(printresultaddition) local function multiplication (number1, number2) local resultmultiplication = number1 * number2 print(resultmultiplication) end multiplication(2, 1)
@aidandoesanimations
@aidandoesanimations 8 күн бұрын
this one was definetly the hardest one so far, heres what i did (its not much ik but it was hard to understand it all in a few minutes): local function addition(number1, number2, number3, number4) local result = number1 + number2 / number3 * number4 return result end local PrintResult = addition(8, 2, 2, 5) print (PrintResult)
@Imnotbald899
@Imnotbald899 2 ай бұрын
I'm gona be honest this is the first one I've done the learning objective on just because I can not get my head around what return is used for, it would be great if you could clarify but I'm guessing it's basically just like a loop thing so after the commands before it has finished it'll return to the line it's set at? (a bit bummed that you need all numbers filled out so you couldn't just do 1 + 2 you then had to divide it by something if you used the first script bit like I did) local function addition(number1, number2, number3) local result = number1 + number2 / number3 return result end local printresult = addition(8, 2, 0.5) print(printresult) local printresult = addition(12, 6, 3) local function subtraction(num1, num2) local Sresult = num1 - num2 return Sresult end local sresult = subtraction(1, 4) print(sresult) local function multiply(mul1, mul2) local mresult = mul1 * mul2 return mresult end local mresult = multiply(2, 10) print(mresult) local function divide(d1, d2) local dresult = d1 / d2 return dresult end local dresult = divide(25, 5) print(dresult)
@Imnotbald899
@Imnotbald899 2 ай бұрын
I have like 10 hours of coding under my belt though (scratch in school, best thing I mad was cocaine shark that was just a shark that span around violently and slowly moved off the board (I also had never heard of cocaine bear before))
@RawPidgeonYummy
@RawPidgeonYummy Ай бұрын
local function addition(number1, number2) local result = number1 + number2 return result end local result = addition(0.1, 0.8) local transparencyVariable = result game.Workspace.Baseplate.Transparency = result made my baseplate change transparency with using the math! guide was very informal and easy to understand thank you.
@Inveist
@Inveist 26 күн бұрын
as someone who has programmed before I know the majority of the things you say already even though I've never programmed in Lua but I watch this so you can get more money. You're welcome. (and I can never get to much practice)
@Dazentz
@Dazentz 2 ай бұрын
thanks bro local function subtraction(number1, number2) local result = number1 - number2 return result end local printresult = subtraction(5, 9) print(printresult)
@Meanfella
@Meanfella 2 ай бұрын
heres what i did! i stopped for a day but im back on my scripting grind, btwdo i always have to use returns when i do something like this? local function add(number1, number2, number3) local result = number1 + number2 + number3 return result end local printresult = add(50, 45, 10) print(printresult) local function sub(number1, number2) local result = number1 - number2 return result end local printresult = sub(12, 2) print(printresult) local function mul(number1, number2) local result = number1 * number2 return result end local printresult = mul(5, 10) print(printresult) local function div(number1, number2) local result = number1 / number2 return result end local printresult = div(10, 2) print(printresult)
@Mr.Films187
@Mr.Films187 12 күн бұрын
local function addition(number1, number2) -- This defines a function called addition that takes two input parameters, number1 and number2. local result = number1 + number2 -- Inside the function, the two input numbers are added together, and the result is stored in the variable result. return result -- The function returns the value of result, so that it can be used outside the function. end local printResult = addition(332, 234) -- This calls the addition function with the values 332 and 234, and the result (566) is stored in the variable printResult. print(printResult) -- This prints the result (566) to the output. local function subtracton(number1, number2) -- This defines a function called subtraction that takes two input parameters, number1 and number2. local result = number1 - number2 -- Inside the function, the second number (number2) is subtracted from the first number (number1), and the result is stored in result. return result -- The function returns the value of result, so that it can be used outside the function. end local printResult = subtracton(1112, 556) -- This calls the subtraction function with the values 1112 and 556, and the result (556) is stored in printResult. print(printResult) -- This prints the result (556) to the output. local function division(number1, number2) -- This defines a function called division that takes two input parameters, number1 and number2. local result = number1 / number2 -- Inside the function, number1 is divided by number2, and the result is stored in result. return result -- The function returns the value of result. end local printResult = division(556, 556) -- This calls the division function with the values 556 and 556, and the result (1) is stored in printResult. print(printResult) -- This prints the result (1) to the output.
@marwanatta
@marwanatta Ай бұрын
Your explanation is fantastic, but I couldn't understand what is the return statement. Is it an alternative to the print statements? and also if I use it in a function and then write a bunch of lines in the same function under it, they won't run will they? pls answer my question cause I think I wouldn't be able to go further like that
@LaufzDS
@LaufzDS 2 ай бұрын
great videos, i learnt alot and still learning!
@GaijenParadox
@GaijenParadox Ай бұрын
The Return statement kinda got me confused on its use but I figured it out by interpreting the function as a power plant, with the return statement you send off the power to where it being called and you can use it for different things, printing etc. hope this helps anyone else confused
@jellyioup
@jellyioup Ай бұрын
So it returns it to the part of the code thats being called and can be used outside of just printing? I'm so confused lol
@Ben0xT
@Ben0xT 4 күн бұрын
i just started coding and you videos helped me alot thank you local function additon(numb1, numb2, numb3, numb4) local result = numb1 + numb2 + numb3 / numb4 return result end local superadditon = additon(3, 7, 3, 5) print(superadditon)
@JohnmichaelYlaya-k9v
@JohnmichaelYlaya-k9v Ай бұрын
I rewatch your video cuz I learned every concept of the playlist but never doing it so I decided to rewatch it and code what I learned so I never confused, so if you are new on this playlist start code not just watching just do it cuz its my biggest regret. local function adition(number1, number2) local result = number1 + number2 return result end local printResult = adition(10, 10) print(printResult) local function subtraction(number1, number2) local result = number1 - number2 return result end local printResult = subtraction(20, 5) print(printResult) local function multiplication(number1, number2) local Result = number1 * number2 return Result end local printResult = multiplication(5, 5) print(printResult) local function division(num1, num2) local result = num1 / num2 return result end local printResult = division(100, 2) print(printResult)
@emir_the_youtuber
@emir_the_youtuber 12 күн бұрын
i did this! local function subtraction(number1, number2) local result = number1 - number2 return result end local subtractionresult = subtraction(9, 4) print(subtractionresult)
@Freaky_KJ.1
@Freaky_KJ.1 Ай бұрын
This is what i made. Thx for ur Amazing tuts! local function addition (Pizza1, Pizza2, Money) local result = Pizza1 + Pizza2 - Money return result end local MoneyLeft = addition(5, 5, 28) print(MoneyLeft)
@billtimmy-p4g
@billtimmy-p4g Ай бұрын
local function addition(number1,number2) local result1 = number1 + number2 return result1 end local printresult1 = addition(2,9)--result 1 is turned into a variable with a function when u use return on it local function subtration(printresult1,num2) local result2 = printresult1 - num2 return result2 end local finalresult = subtration(printresult1,10) print(finalresult)-- using that same variable I used it as a secondary number for result 2
@Lejor
@Lejor 2 ай бұрын
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
@BrenGamingYesOfficial
@BrenGamingYesOfficial 15 күн бұрын
friend: do u use a calculator me: nah, i use roblox studio
@imlikesomethingidk8827
@imlikesomethingidk8827 4 ай бұрын
local function addition(numb1,numb2,operator,numb3) if operator == 1 then return numb1 + numb2 * numb3 -- Numb 3 can be left as one else return numb1 - numb2 / numb3 end end local printnresult = addition(10,20,1,1) print(printnresult, " And BrawlDev is awesome!") I have learned a bit of coding but forgot the more advance one, so yeah :/
@OfficialF0rced_
@OfficialF0rced_ 2 ай бұрын
You can do like a simple add, sub, mul and div, you can do this: local function add(num1 + num2) local result = num1 + num2 print(result) end And so on...
@crimeanball
@crimeanball 14 күн бұрын
local function = addition(Left, Right) local result = Left + Right return result end local printresult = addition(180, 90) print(printresult) local printresult = addition(-180, 90) print(printresult) ye i totally need to train this more
@Threxxy
@Threxxy 17 күн бұрын
*2 number subtraction* local function subtraction(n1, n2) local result = n1 - n2 return result end local printResult = subtraction(5,2) print(printResult) *3 number subtraction* local function subtraction(n1, n2, n3) local result = n1 - n2 - n3 return result end local printResult = subtraction(5,2,2) print(printResult)
@RobloxKotykmyy
@RobloxKotykmyy 9 күн бұрын
My example:local function Minus(number1, number2) local result=number1 - number2 return (result) end local printResult = Minus(8, 6) print (printResult)
@barry0_0
@barry0_0 Ай бұрын
What i made: local function division(num1, num2, num3) local result = num1 / num2 - num3 return result end local x = division(8, 5, 5) local function adittion(num1, num2, num3, num4) local result = num1 + num2 /num3 * num4 return result end local y = adittion(5, 9, 6, 34) print(y + x)
@mrfloaties
@mrfloaties Ай бұрын
-- Math Functions local a = math.random(1,10) local b = math.random(1,10) local function addition(num1, num2) local result = num1 + num2 return result -- sets the item to the value end local printResult = addition(a, b) print(printResult)
@FrostyAzure
@FrostyAzure 2 ай бұрын
I think local makes it so the variable only exist in that specific script and global makes it so that the variable exists in every script, am i right?
@birthdayboyplayz
@birthdayboyplayz 3 ай бұрын
local function division(number1, number2, number3, number4) local result = number1 / number2 + number3 * number4 print(result) end -- Call the division function with the correct syntax division(6, 3, 4, 9)
@Ecaw
@Ecaw 2 ай бұрын
My work: -- PERAMETERS -- --The difference between arguemntts and parameters is what we use to create our variables inside our functions. local function addition(number1, number2) --MUST be seperatted with a comma and a space :D local result = number1 + number2 return result --Reurns to printResult to give the answer end --Return can also be used to exit out of functions, which means that it can end the function at whatever line it is called and the rest of the function will not run. local printResult = addition(8,2) --Feeds back into stated function print(printResult) local function Math(number1, number2) --MUST be seperated with a comma and a space :D local result = number1 + number2 print(result) end Math(5, 2) --NOT RESTRICTED TO NUMBERS! Can be ("string", "string") or ("Boolian(True)", "Boolian(False)") Math(3, 2) Math(9, 2) -- Because number1 and number2 are placeholders, we are not restricted to the same value. Possibly useful for leaderboards and calculating rewards.
@Khr0maEffect
@Khr0maEffect 2 ай бұрын
local function multiplication(int1, int2, int3) ("int" as in "Integer") local result = int1 * int2 * int3 return result end multiplication(7, 8, 3) local multResult = multiplication(12, 9, 7) print(multResult + 73) This prints the number 829
@personnnnnnnnnnnnnnnnnnnnnnn
@personnnnnnnnnnnnnnnnnnnnnnn 2 ай бұрын
local function addition(number1, number2, number3, number4) local result = number1 + number2 * number3 / number4 return result end local printResult = addition(8, 2, 2, 2) print(printResult) hey your tuts help a ton and 2 things that i would recommend are one try not to say "uh" a lot and two don't delete stuff you make just make a new script and name it (whatever the subject is)2 or just go down or press enter
@tostmakinesi42
@tostmakinesi42 15 күн бұрын
what i did in this episode: local function addition(number1, number2, number3, number4) local result = (number1 + number2) * number3 - number4 return result end local printResult = addition(8, 2, 5, 35) print(printResult)
@lucaskeenofficial
@lucaskeenofficial 14 күн бұрын
This is what I put Local function addition(number1, number2, number3) Local result = number1 + number2 / number3 Return result End Local printResult = addition(3, 9, 5) Print(printResult)
@Frozen_Cake
@Frozen_Cake 27 күн бұрын
local function test(N1, N2) local add = N1 + N2 return add end local function test2(N3, N4) local minus= N3 - N4 return minus end local function test3(N5, N6) local final = (N5 * N6) / 2 return final end local a = test(2,8) local b = test2(7, 3) local c = final(a, b) print(c) Thanks BrawlDev! You cool lol!
@babosaofficial
@babosaofficial 4 ай бұрын
exited to see how you explain tables!
@that-original-channel
@that-original-channel Ай бұрын
Your the best heres what I made! local function addition(x, y) local result = x + y return result end local function subtraction(x, y) local result = x - y return result end local function multiplication(x, y) local result = x * y return result end local function division(x, y) local result = x / y return result end
@navs_svan
@navs_svan 2 ай бұрын
-- ADDITION local function addition(number1, number2, number3) -- Calling function and adding parameters local result = number1 + number2 + number3 -- Create variable to add the parameters return result -- Return the result back into the function end local AdditionResult = addition (3, 2, 5) -- Variable to call the function and add the parameters print (AdditionResult) -- Print the final result -- SUBTRACTION local function subtraction(number1, number2) local resultTwo = number1 - number2 return resultTwo end local SubtractionResult = subtraction(10, 5) print(SubtractionResult) -- MULTIPLICATION local function multiplication (number1, number2, number3) local resultThree = number1 * number2 * number3 return resultThree end local multiplicationResult = multiplication (3, 3, 3) print(multiplicationResult) -- DIVISION local function division(number1, number2) local resultFour = number1 / number2 return resultFour end local divisionResult = division(100, 10) print(divisionResult)
@SplashionRBX
@SplashionRBX 2 ай бұрын
you're making this so easy to understand! thank u!
@dabent874
@dabent874 2 ай бұрын
this is what i did : (btw i love you brawldev) local function subtriction(number1, number2) local result = number1 - number2 return result end local subprint = subtriction(9, 4) print(subprint) local function duplicitation(number1, number2) local result = number1 * number2 return result end local printdup = duplicitation(8, 9) print(printdup) local function division(number1, number2) local result = number1 / number2 return result end local printdiv = division(10, 2) print(printdiv)
@euloveplayz6102
@euloveplayz6102 3 ай бұрын
Thank you so much! I've been struggling with return statements
@GoofySillyGuy
@GoofySillyGuy Ай бұрын
i made this code where basically you have 2 parts, and it tells you the locations of them in relation to each other and then if part1's x position is more than 0 it turns part 2 red, so here it is: local part1 = game.Workspace.Part local part2 = game.Workspace.Part2 local function addition(part1, part2) local result = part1 - part2 return result end addition(part1.Position, part2.Position) if part1.Position.X > 0 then part2.BrickColor = "Really Red" end local printresult = addition(part1.Position, part2.Position) print(printresult)
@ikarie433
@ikarie433 2 ай бұрын
function adding(num1, num2) return num1 + num2 end local result = adding(7, 2) local correct = 10 if result == 10 then print("10 is the correct answer") else print("10 is not the correct answer") end
@Sim_avoine
@Sim_avoine 17 күн бұрын
i try without checking and ive done that : local function multiplication(number1, number2, number3) local result = number1 * number3 * number2 return result end local Printresult = multiplication(5, 9 ,3) print(Printresult)
@IceyDude1
@IceyDude1 2 ай бұрын
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
@Wilk1199
@Wilk1199 10 күн бұрын
so i made : local function a(n1,n2,n3) local r = n1 / n2 * n3 print(r) end a(8,4,10) a(134.213*4,12,100) and thanks for another very good tutorial
@MR.Risindu
@MR.Risindu 2 ай бұрын
local function subtraction(number1, number2) local result = number1 - number2 return result end local printResult = subtraction(10, 8) print(printResult)
@AlonHH
@AlonHH 2 ай бұрын
commenting rarely but this man is perfect teacher
If Statements - Roblox Beginners Scripting Tutorial #8 (2024)
12:51
How “Impossible” Features Are Actually Coded
20:47
ByteBlox
Рет қаралды 67 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 25 МЛН
Não sabe esconder Comida
00:20
DUDU e CAROL
Рет қаралды 49 МЛН
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 48 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 12 МЛН
What Roblox Doesn't Tell You | Roblox Studio
9:38
Stewiepfing
Рет қаралды 30 М.
Can 14 Random ROBLOX Developers Make a Game in 7 DAYS?
15:56
BrawlDev
Рет қаралды 136 М.
How I made Math: Final Boss
16:31
Jake Walker
Рет қаралды 323 М.
Can I Make a VIRAL Roblox Game in 1 Hour?
15:16
Temprist
Рет қаралды 6 МЛН
Functions - Roblox Beginners Scripting Tutorial #6 (2024)
8:36
How Unoptimized Can a Roblox Game Get?
16:49
ByteBlox
Рет қаралды 320 М.
I Asked Roblox Billionaires How To Get Rich
41:51
CubeINC
Рет қаралды 2,7 МЛН
Can 6 DEVS Make a STORY Game Without Communicating?
15:32
RoDev
Рет қаралды 2,3 МЛН
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 25 МЛН