Roblox Beginners Scripting Tutorial 7 - Returning

preview_player
Показать описание

This might be a bit trickier but keep practicing it and you will get it.

Got any questions or suggestions for this video? Leave it in the comments.
Рекомендации по теме
Комментарии
Автор

I think the reason why return can be confusing to some is because people don't find the use of it. But it's very important, and scripters use it a lot when making games. Don't ask yourself what the intent for it is, and just learn what it does. If you actually don't understand it, then ill give you a straightforward but simple explanation. Basically, functions are variables. What are variables for? Variables exist to hold values from booleans, to strings, and numbers. Functions in default have no value when created, but when you use return, you give it a value. I know this video is old, but if you happen to stumble upon this comment and need help, we have a group on Roblox named Faruque's Games, where we answer questions and help people learning how to script or build.

xbutterguyx
Автор

I've learned more with these tutotials than other tutorials combined together, thank god for these blessings...

scrumpton
Автор

7 years later, and this is still valuable information im learning rn <3

bb-tetx
Автор

If anyone is still confused on this I’ll try to make it simple. So let’s say you want to set up a shop. You make an item cost let’s say 100 right. Then you add a return item option and the code “return” will return the amount that you set it to back to you.

bruhk
Автор

Simply you usually use it to stop functions from running and finding errors.

Vortex-qbse
Автор

But the point of this tutorial is to teach you how to use "return" so that in the more advanced tutorials, you will know how to use it. You can do a lot more advanced stuff using return.

PeasFactory
Автор

Yup, that will be coming on after this basic tutorial series :)

PeasFactory
Автор

Return is substituting for the parentheses that contains the function call. 
Ex: function name()
           code
           return 5
      end
      print(name())
      --[[The return substitutes 5 for name() in the parentheses.
      print(name()) becomes
      print(5)

Alehero
Автор

I finally understand after watching the video 4 times over. It's really not that complicated. Thank you so much!

bruhhsshsbdbd
Автор

Heres my take on it.
Im your function return gives it a value:Numbers (4, 100, 1.2), Strings("Hello World"), Bools (true false), variables?.
The last example really helped me. Watch this multiple times as its the only decent tutorial on the subject on Youtube.
Practice always, cheers.

AngryBirdzMTheOneonlyreelkool
Автор

Thank you so much for making these tutorials! They helped me understand scripting in ROBLOX a lot!

Kevinluo
Автор

Peaspod, I honestly cannot thank you enough for these tutorials. I have started at vid 1 and I am liking every single video as I watch the next to next. When I become the next big dev I will thank all my success to you!!!

JuiceHasser
Автор

i got this channel from The dev king, HE got his scripting lesson from here, i wonder where THIS GUY got his scripting lessons from, and so on lol.

bb-tetx
Автор

Guys an example would be
function add(num1, num2)--Num1 and Num2 are arguments kind of like variables can be anything you want. A string or 2 numbers or more.
print("Finding sum.")
return num1 + num2 --It is kind of like a variable, it will return numbers 1&2 when they are called
--print("Sum found")
end

x = add(5, 2) --5 is num1, 2 is num2)
print(x)--Prints the variable above

HCBBExplore
Автор

You guys need to step out of your confornt zones, scripting wont get any easier. The path to becoming a great scripter will be littered with carcasses of people who just didn't have enough, who just gave up because they couldn't understand returning or anything else, age doesn't matter. You have to learn one point or another. If you keep telling yourself "Oh, I still don't know all the basics" when you've pretty much saw everything there is know and praticed and practiced. You need to push out of that confornt zone and push into the harder material.

bstandsforbuilding
Автор

Keep experimenting it. I will be covering returning very briefly in tutorial 8 so you might understand it a bit better then. If you still don't understand it then try skipping it and coming back to it later on in the tutorial series. You might understand it then.

PeasFactory
Автор

I have a friend thats scripts on discord and your vids makes so much more sense that was he's saying you just make it much more simpler. thank you.

ultimatewaybigx
Автор

For those unable to understand it first try here is something that helped me. A return is like the answer to a math question for example: what is 7+2 its 9 so a return would respond with if the answer is correct or not. I'm not very good at explaining hope it helped. This is what I wrote to help me understand.

-- What is the answer for this math question jimmy? Its 9 I think, let me go ask out teacher ms.return.
mathquestionplusanswer = 7 + 2


function returnexplenation()
print (mathquestionplusanswer)
--return(teacher) yes jimmy it is correct
return print "Good job your correct!"
end

returnexplenation()

YeaBoiWesley
Автор

anyone thats having difficulties, you may think have you could just say print 20 or print 10, but I tell you returning actually become useful in scripting, its easier to use it rather than just constantly printing. It's not the most useful thing but it can make your life easier in scripting

userprecisealt
Автор

ME ; LAST SCRIPTING VIDEO AND I WILL GO TO MY BED
PEASFACTORY SCRIPTING TUTORIALS : HOLD MY DRINK

dna