How to script in Roblox Studio in 2024: Episode 4 - Functions

  Рет қаралды 10,999

Avercile

Avercile

Күн бұрын

Пікірлер: 95
@Avercile172
@Avercile172 10 ай бұрын
QUIZ: Concepts: --------------------------------------------------------------------------------------------------------- Question #1: What is a function? Question #2: What is a parameter and what is it useful for? Question #3: What is an argument? Question #4: What is return and what is it useful for? Question #4: What is the difference between local data and global data? --------------------------------------------------------------------------------------------------------------------------- Problems: ---------------------------------------------------------------------------------------- Question #1: Create a function that when called, will take three inputs (arguments) from three corresponding function parameters and multiply all of them together and print the result in the output. Question #2: Create a function that when called, will take one input (argument) from a corresponding function parameter and the parameter represents the substitute for a BrickColor you are going to change on a part, so that when you call the function, the argument will be the string representing the BrickColor you're changing the part to. Question #3: Function A is inside another function B, without using return, what other way can you run whatever's in function A successfully? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Leave answers in replies, I will reply to all of you and will be going over all of these next video, so try them before going to the next tutorial!
@rbegs8989
@rbegs8989 9 ай бұрын
It`s like i`ve understanded the video but i dont know how to explain these.
@aayanm1g_osu
@aayanm1g_osu 8 ай бұрын
u sound like my math teacher 💀💀
@ithinkiamok
@ithinkiamok 8 ай бұрын
Concept 1: A function is a data type that holds a script, which can be run when being called Concept 2: A parameter is like a holder value you give into the function. Its useful because.. idk lol. Concept 3: Arguments basically give values to the parameters for example :1. local function subNumbers(o, p) 2. return o - p 3. end 5.print(subNumbers(10, 5)) Basically it sets o to the value 10 and p to the value 5. Concept 4: I dont know what a global data or local data means but i do know what global variable and local variable means, a global variable can be accessed throughout the whole script if mentioned in a function so instead of typing “local number = 2“ you can just get rid of the local and it will become global. And with the local it can only be accessed in the function Please correct me if i‘m wrong.
@jimmeyscool
@jimmeyscool 8 ай бұрын
#1 A function is a block of code that only runs when you call it. #2 A parameter is a placeholder #3 an argument is what you put in () #4 Return is for lets say i have 1 and 2 and return say to go 1+2 or 1−2 #5 Local data is stuck in the block of code a global can go aneywhere
@notaperson9202
@notaperson9202 8 ай бұрын
Problem #1: local function newMultiplication(a,b,c) local ans = a*b*c return ans end Problem #2 local function color(red) local x = "BrickColor.new("Really red")"" end Problem #3 local function fA() local function fB() x = "The answer" end end print(x)
@stoneproductionz
@stoneproductionz 7 ай бұрын
I think I've learned the most I've ever learned when it comes to roblox coding, other videos don't break it down like you do, thanks.
@Zythlan-uw4bc
@Zythlan-uw4bc 6 ай бұрын
You put alot of effort into this series and i really commend you for that, Thank you so much!
@jaddy0
@jaddy0 4 ай бұрын
this is the best tutorial series of scripting ive seen. the official roblox tutorials made me wanna step on lego. i already knew c# so you explaining this in your unique way really helped me. Thanks! Edit: for any confusion no this language is not c# its lua i just wanted to say i have experience edit: currently making a new roblox game, the Tutorial has helped me, also, the guy in the replies, since for some reason my reply isnt shown, no, roblox is in lua, im just saying there are similarities
@legendgamingandvlog5288
@legendgamingandvlog5288 4 ай бұрын
Wait this is c# ? TBH, I thought it was python.
@jaddy0
@jaddy0 4 ай бұрын
@@legendgamingandvlog5288 it is lua but ive already had experience with c#
@GalaxyPlayzRBLX
@GalaxyPlayzRBLX Күн бұрын
Learning! local function myFunction() …..number = 5 end myFunction() print(“how good is this youtuber”) print(number+number)
@bigpapi5343
@bigpapi5343 4 ай бұрын
Something that helps me grasp what he is saying: Think about what you are writing in normal english. Say you put in local function sum(a, b) | local c = a + b | return c end You are basically telling the machine "Hey, whenever I ask for sum (1, 1), I am telling you that a=1 and b=2. The procedure is simple, just add a and b, and you will figure out what c is. Go do that and RETURN to me with your answer for c." I don't know about you, but when I look at that message written out in normal english, I realize that I am saying more than I have to, like I'm talking to a baby really slowly so he understands. The machine isn't that clueless, so instead you might ask it: "Hey, when I ask for sum (1, 2), I am telling you that a=1 and b=2. RETURN to me with what a+b is." In syntax, that is: local function sum (a, b) | RETURN a + b end I would imagine this is how you optimize code. If you make the message more concise and to the point, its easier for the machine to grasp; it does not have to think that much about what you are actually saying.
@mofa2850
@mofa2850 3 ай бұрын
Thx bro this helped a ton 🙏
@FredeBearFaz
@FredeBearFaz 3 ай бұрын
yoo thank you!! You explain everything so well and easy, most of these tuts dont make any sense to me but youve helped me alot! You also explained "return" so well too! I honestly am so glad your tutorial exists
@Candoriam
@Candoriam 6 ай бұрын
Best Tutorial I've seen yet thank you
@shnizelberotev8619
@shnizelberotev8619 5 ай бұрын
In bob we trust!
@eilertsandsdalen8402
@eilertsandsdalen8402 4 ай бұрын
this is how i think of it: it's like the return explains what to do, for example if you want 5*5 the return says you're multiplying for example a, b thats ecual to 5, 5
@mueqatrae1464
@mueqatrae1464 4 ай бұрын
beautifully explained thank you so much, please keep it up
@AMcdonaldsWorker
@AMcdonaldsWorker 2 ай бұрын
Q1: A line of code you can call upon when you write it out Q2: you can do math with it and calculate variables like a and b Q3: an argument is what you put in 2 brackets Q4: you can call upon something inside a function without making it global Q5: local data can only be called upon in a block and global data you can call it anywhere
@user-zr8zv9ep5o
@user-zr8zv9ep5o 2 ай бұрын
these tutorials have helped me a ton, only problem is that i cant hear him as well as i did in the earlier vids for some reason. still watch tho!
@user-zr8zv9ep5o
@user-zr8zv9ep5o 2 ай бұрын
the global scope thing got too confusing for me :(
@SuperBenBoy5886
@SuperBenBoy5886 8 ай бұрын
For over the past year I've never been understand return and parameters, but now I FINALLY understand them (I think...?), Thanks! I'm only 4 episodes into this series so Idk if you have done this yet, but can you please show off more ways you could mess around with functions/return/parameters? Right now I have only seen what they do (through means of printing and math), but I've never been able to fully grasp how you would USE them. Maybe show examples through means of changing part properties? Thanks.
@Dalucsta
@Dalucsta 3 ай бұрын
THis is what i made and it actually works in studio local function addnumbers(x,y) local r = x + y return r end ey = 3 yo = 5 print(addnumbers(ey,yo)) asd=addnumbers(ey,yo) part1 = game.Workspace.Part part1.Transparency = asd playerscore = 0 function addscore() playerscore = playerscore + 1 end if part1.Transparency
@I_like_roblox894
@I_like_roblox894 3 ай бұрын
other tutor : nah. this tutor : oh yeah! reason : because its understandable.
@fidosesk
@fidosesk 3 ай бұрын
best tutorial
@Dalucsta
@Dalucsta 3 ай бұрын
for all of the kids like me that don't really know what he was saying this is how I imagine it. local function addnumbers(x,y) local sum = x + y return sum end print(addnumbers(2,3)) yo add numbers can you add x + y and then put it into this box called sum? Then return it for me. (Addnumbers speaking now) Bruh first tell me what x and y is! ok fine but also print it here its 2 plus 3 just plug it in to x and y. basically this is creating an equation but you don't know what numbers to use yet. so when you find out you just plug it into that same equation. I hope this helped.
@Smotuu
@Smotuu 2 ай бұрын
Bro what, how tf did this comment make me understand
@rowlzz
@rowlzz 2 ай бұрын
yeah because x and y are the uknown number, great explanation ig!
@Dalucsta
@Dalucsta 2 ай бұрын
@@rowlzz lol Thanks!
@baconph2578
@baconph2578 6 ай бұрын
function for me is like you can reuse the code over and over again and makes somethin works by calling it.
@mrgamerfloppa5898
@mrgamerfloppa5898 4 ай бұрын
RIP 10 braincells who died trying to comprehend. They were great operators.
@SantiQuibo
@SantiQuibo 3 ай бұрын
whenever im watching this and i see something i already understand i just turn it into a scratch block like the function being the custom block lol
@qriusty5041
@qriusty5041 5 ай бұрын
Where did you first learn to code?
@MrsEpic23
@MrsEpic23 7 ай бұрын
you know the .... thing infront of local and sum. it kinda confused me because my script did not have that. thats probably why it didn't really work. could you reply explaining this since im quite confused. (ok now my script has that but x + y is underlined in red, why is it underlined in red, could you explain that. I copied everything to take a look at why it is underlined in red but it still was underlined in red. was that an update?)
@its_blockgamingyt8140
@its_blockgamingyt8140 4 ай бұрын
local function PrintSomething() print("tysm") end PrintSomething()
@nathanallred663
@nathanallred663 Ай бұрын
i can give you an idea at 21:47 u can say local functionh multiplyNumbers(a,b) is making the a and b return is saying what to do with those like a*b then printing is basically putting that in the output pls pin me thank you
@kkayyidkd
@kkayyidkd 9 ай бұрын
hey.. why do we need or we use local before a function if we can use function without the local word???
@cabbycabbage8119
@cabbycabbage8119 9 ай бұрын
Yeah I am wondering the same thing
@sneakydapo
@sneakydapo 9 ай бұрын
he said if you use local then the variable will only work for that block but if you dont use local then you can use the variable for your whole script which can cause confusion.
@kkayyidkd
@kkayyidkd 9 ай бұрын
@@sneakydapo i alr finished watching the video, i understand now
@Ivraft
@Ivraft 8 ай бұрын
Functions didnt work and i followed everything you said.
@Wojinski
@Wojinski 8 ай бұрын
same thing happened for me
@melakkush
@melakkush 7 ай бұрын
Worked for me
@baconph2578
@baconph2578 6 ай бұрын
you must be doing something wrong.
@mrgamerfloppa5898
@mrgamerfloppa5898 4 ай бұрын
Listen more carefully. You might be only copying the code he wrote rather than listening what he’s saying
@alekounis
@alekounis 6 ай бұрын
im on 10:15 mins in but i dont understand what is this function (function() pls explain it to me
@Buiboy19
@Buiboy19 4 күн бұрын
Sadly noone in the comment section actually likes helping ppl, and im nto that far through the vid so, sorry!
@Buiboy19
@Buiboy19 4 күн бұрын
oop you wrote it wrong lol
@theminecraftnoob9357
@theminecraftnoob9357 4 ай бұрын
this episode took me 2 hours because i was writing stuff down
@rinlitacharanthananpon9966
@rinlitacharanthananpon9966 7 ай бұрын
My brain just can’t comprehend anymore
@stephen5070
@stephen5070 5 ай бұрын
Please increase the volume, I can barely hear it even at 100% volume.
@PFB331
@PFB331 2 ай бұрын
I GET MAHORAGA I SEE IT
@PFB331
@PFB331 2 ай бұрын
How to make kid smart (gives a avercile vid)
@Jack_hasmoney123
@Jack_hasmoney123 8 ай бұрын
Hi
@bun1900
@bun1900 2 ай бұрын
Hi
@IM_THAT_THING
@IM_THAT_THING 2 ай бұрын
thsi video a little bit hard to undestand
@muigokumaster9659
@muigokumaster9659 5 ай бұрын
38:00 u don't need to return
@ahmadkarkashan
@ahmadkarkashan 4 ай бұрын
i do not expect you to understand this right now me: x=2 y=3 EZ
@astridberruguete2128
@astridberruguete2128 3 ай бұрын
Bro only talks about math i am here to learn good scripting not math class I'm not here to mess around either
@gladeburst
@gladeburst 20 күн бұрын
Did you know coding has a lot of math in it?
@thebluesponge2
@thebluesponge2 10 күн бұрын
If you wanna script but ur too lazy to do math then GET OUTTT
How to script in Roblox Studio in 2024: Episode 7 - Loops
28:57
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 115 МЛН
How I Turned a Lolipop Into A New One 🤯🍭
00:19
Wian
Рет қаралды 10 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 32 МЛН
Programming Rarity is Harder Than You Think
12:31
ByteBlox
Рет қаралды 274 М.
Making a Game in Lua with No Experience
5:52
Goodgis
Рет қаралды 320 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 719 М.
Roblox Scripting Tutorial - Ep 12 | All About Events
24:59
Hiatus
Рет қаралды 4,9 М.
How to script in Roblox Studio in 2024: Episode 2 - Variables
19:06
How To Script Faster | Roblox Studio
6:56
Ludius
Рет қаралды 7 М.
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 391 М.