Roblox How to Script for Beginners | #14 | ModuleScripts
HTML-код
- Опубликовано: 5 окт 2024
- This is the 14th video in this scripting series, and today I'm going to be covering ModuleScripts.
A module script is a Lua source container that runs once and must return exactly one value. The most important thing that a ModuleScript does is allow you to adhere to the don't-repeat-yourself principle, or the DRY principle. This principle says that you should write code once and reuse it, rather than rewriting the same code over and over again.
Some key points in this video are:
1. Module Scripts don’t run by themselves
2. A Script or LocalScript needs to require the ModuleScript for it to run, and it will only run once in each environment. Once on the server, and the once per client (again only if it was required by the server / client)
3. The return statement needs to be the last thing in the Module Script
4. Module Scripts can return anything, but they usually used to return tables
Join the Discord to ask questions: / discord
Read more about ModuleScripts:
developer.robl...
education.robl...
Thanks! for watching! Join the Discord here: discord.gg/Mtf4KNY
Your the best RUclips for learning how we can script thank you
Glad you think so! Keep coding!
For a long time I had been searching for someone who actually explains Lua rather than how to use it for specific things like a door or moving parts. I’m glad you made this series, it is very helpful. I hope your channel experiences great success!
Glad it was helpful! Thanks for the kind feedback!
Bro I asked u months ago now I know all even delta time but anyway thanks
I wish I could have gotten it done sooner! I'm back on track now! I'm glad to hear you've been learning
Amazing tutorials man
Glad you like them!
Cool
Thanks
Amazing video lol
Thanks!
continue the series please I'm begging lol
Soon! Maybe not exactly the series but videos that still build off it
Whenever I print the table of a module script it shows the functions i put inside of it to
Thank you so much but what are threads tho??
It been 2 year since you uploaded about lua
can you cover things like cframe, and things like that
Epik
Thanks!
Are their more comin?
Yes and no. I covered all of the "basics" for programming in general in that tutorial. You need to know how to use variables, functions, operators, loops, and data structures (tables) in order to program. Now that I've covered those, I will make standalone videos for different topics such as the different services. All of the standalone videos I make will use concepts I taught in the series. So it isn't abandoned, but it doesn't necessarily make sense to tag more videos on the end of the series sense they won't build on each other as much
I am 700 subscriber
Thank you so much!
Can variables work?
What do you mean?
@@CyberCreator can you access variable from the module scripts
this is so hard to understand lol
super underrated tho, i've seen tutorials on this from 200k subs youtubers and this one is the best series yet.
@@bibooo3585 same here man so hard to get going, different ways of doing stuff or the order people write code. and if u try find a code to do something u end up finding Multiple different codes all wrote differently to do the same thing lmao some are better than others or theres some better ways around things omg... but this guy explains it good . Honestly all of the Knowledge we need is on roblox website it tells u everything there is in the studio but its hard goodluck..
can i use "script.parent"in module script?