Explaining ModuleScripts As If You Were 5

Тәжірибелік нұсқаулар және стиль

Buy now to get BONUS future units for free:
linktr.ee/ByteBlox
discord: / discord
wondered how to make a main menu in roblox studio? or how to create a shop which has working GUI? ive made lots of 2024 roblox scripting tutorials about all the different bits of roblox to give you some up-to-date information about all of its properties and events.
my goal is to simply give some insight on how to use the various features and instances roblox studio, and show you some fun stuff you can do with them. thanks for checking out this roblox scripting tutorial :)

Пікірлер: 212

  • @byteblox100
    @byteblox1004 ай бұрын

    Get all of my knowledge in one package:
linktr.ee/ByteBlox

  • @fardmonkegaming

    @fardmonkegaming

    4 ай бұрын

    can i send you my stuff owo

  • @LevixTheCreator

    @LevixTheCreator

    4 ай бұрын

    @@fardmonkegaming lil bro is weird

  • @fardmonkegaming

    @fardmonkegaming

    4 ай бұрын

    ​@@LevixTheCreator shut up

  • @Frog_eatsalot

    @Frog_eatsalot

    4 ай бұрын

    @@fardmonkegamingur a creep

  • @theperfecttroller

    @theperfecttroller

    4 ай бұрын

    @@LevixTheCreatorme when i have never heard of ironic humor

  • @Enfirdy
    @Enfirdy4 ай бұрын

    As a professional 5 year old, I think I speak for the entire community that we are thankful for this educational video.

  • @leonardoshida

    @leonardoshida

    4 ай бұрын

    As a 0.69 year old i understood it

  • @MinecraftRob321

    @MinecraftRob321

    4 ай бұрын

    Yes, having 6+ years in experience of being 5 years old, I feel as if this perfectly resembles mine, and others opinions.

  • @-stewie-

    @-stewie-

    4 ай бұрын

    Oh good heavens, it seems like I am out of luck, I’m 4!

  • @leonardoshida

    @leonardoshida

    4 ай бұрын

    @@-stewie-shimmy ay shimmy ay shimmy ay shimmy ay

  • @MinecraftRob321

    @MinecraftRob321

    4 ай бұрын

    I haven't tried this method out, but maybe it will work for you, all you must do (theoretically) is wait a singular year and you may be granted the role of "5 Years Old". Tell me if works, and thank you for your time good sir.@@-stewie-

  • @Chaseroony
    @ChaseroonyАй бұрын

    i finally understand it holy crap you are amazing

  • @QuiteCringe

    @QuiteCringe

    26 күн бұрын

    oh hi chaseroony

  • @Johnny_981

    @Johnny_981

    12 күн бұрын

    NAH 3 LIKES

  • @MajesticUC
    @MajesticUC4 ай бұрын

    To summarise, module scripts will return a value which can be accessed from any script, server or client. They are used to reduce repetitiveness in scripts by providing functions meaning you don't have to rewrite functions in every single script. This also reduces inconsistency in scripts. Every developer uses them even if they don't have to use them so if you aren't using them right now... WHAT R U DOING?!!?

  • @wedoalittletrolling723

    @wedoalittletrolling723

    4 ай бұрын

    Good but the return value should still be a table, as sometimes i encounter module scripts that return nothing but nil, and all it does is regular code stuff that a regular script would perform.

  • @vaeppur

    @vaeppur

    4 ай бұрын

    @@wedoalittletrolling723 if it's returning nil then there's something undefined in there or not set up correctly (im assuming these are YOUR modules, not marketplace). and it's not just the fact that it functions like a script, it's a script toolbox essentially; script: "i need a wrench for this!" module: "okay, here is a wrench! any other tools just let me know"

  • @wedoalittletrolling723

    @wedoalittletrolling723

    4 ай бұрын

    @@vaeppur usually i sometimes forgot that doing 'if bla bla then return end' in a module that is in the global scope would make it not return anything since i am used to that in regular scripts

  • @hi-kt3qr

    @hi-kt3qr

    4 ай бұрын

    you can use also modulescripts as a database for tool stats etc

  • @robuxyyyyyyyyyy4708

    @robuxyyyyyyyyyy4708

    Ай бұрын

    zKevin moment

  • @AbcreatorDev
    @AbcreatorDev4 ай бұрын

    One thing you didn't mention in your video but is a useful property of ModuleScripts is that they are only run ONCE per context (server / client). Requiring a ModuleScript a second (or more) times on the same context will return the exact-same table without running any code present in the ModuleScript. As a result, ModuleScripts can act as a "storage container" for your scripts to communicate with each-other as the returned module (or as you said, table) will always be the same "instance" of the module / table across all scripts on the same client/server. An example: I have a basic ModuleScript similar to the default code provided when creating a new ModuleScript. Then I have two server scripts, each requiring the ModuleScript. One sets a "key" to a value, the second script waits a second and then prints the module; despite both of these pieces of code being in different scripts, the key + value we set in the first script is printed from the second script!

  • @Riv3rz

    @Riv3rz

    4 ай бұрын

    One thing huh

  • @Elliot997

    @Elliot997

    4 ай бұрын

    @@Riv3rz wreqwasd dffgj *yes*

  • @YorktownClass

    @YorktownClass

    Ай бұрын

    Two things huh

  • @ScriptedExpert
    @ScriptedExpert4 ай бұрын

    Good explanation. A lot of people get confused by modulescripts but this makes them sound really simple and easy to use. Another topic you should cover is Metatables.

  • @pcoi94

    @pcoi94

    4 ай бұрын

    yeah oop is really usefull

  • @JohnDoeNobody

    @JohnDoeNobody

    4 ай бұрын

    I agree, I've been wanting to learn Metatables for a while now.

  • @Aftertime400

    @Aftertime400

    4 ай бұрын

    Metatables are easy to learn

  • @cosmic7140

    @cosmic7140

    4 ай бұрын

    I don't think he knows metatables

  • @cosmic7140

    @cosmic7140

    4 ай бұрын

    ​@Aftertime400 if you know what you're doing

  • @Tkdriverx
    @Tkdriverx4 ай бұрын

    ModuleScripts are primarily used for reused code, or custom classes (in object-oriented-programming or OOP). If you need more than one script to use a certain function, don't rewrite it in the other script, make a utilities module with all your reused functions. And if using it to store data in a dictionary, the module will hold onto values if they are changing frequently. However, if a module is required both on client and server, the data is not replicated between them.

  • @ProtonC100
    @ProtonC1004 ай бұрын

    best roblox dev yt channel ever. I literally got into dev bc of you. ty bro

  • @Wurfeln
    @Wurfeln4 ай бұрын

    as a 50 yr old i thank you for your work

  • @NaraSherko

    @NaraSherko

    4 ай бұрын

    So old bro is turning into a roblox grandpa. "Too old for simulators" "Back is my day we had confusing ahh scripts"

  • @uliveulearnandregret
    @uliveulearnandregret4 ай бұрын

    another good analogy, think of a module script like a DLL file, DLL files don't run on their own on your computer, they get injected on runtime into the specified program that needs to use them (or is forced to with dll injection). A module script contains functions and variables while the script or local script uses pieces of those functions and variables to make custom behavior happen. Hence why we have community modules like Smart Bone, Smart Bone 2, and Good Signal out that work with local scripts and server scripts to enhance development for all.

  • @wedoalittletrolling723

    @wedoalittletrolling723

    4 ай бұрын

    The engine itself is full of DLL then

  • @privatefield.

    @privatefield.

    4 ай бұрын

    i dont believe you, you are s0!

  • @uliveulearnandregret

    @uliveulearnandregret

    4 ай бұрын

    in a way, yes@@wedoalittletrolling723

  • @arisethee

    @arisethee

    4 ай бұрын

    A DLL is a library that contains code and data that can be used by more than one program at the same time. - Ah, almost like the definition is right in front of our eyes, "Fragment". How are libraries defined on an OP? DLLs, how does a programming language define libraries? by Module(s).

  • @aoqia

    @aoqia

    3 ай бұрын

    This helps a lot coming from C++ :D

  • @Sand.
    @Sand.4 ай бұрын

    I’ve been using modules for a lot of things over the years & they are very useful

  • @Hazuzis
    @Hazuzis3 ай бұрын

    I'm thinking if I should subscribe for more explanations, you're doing it so good and quick. thx

  • @bloxerhd7046
    @bloxerhd70469 күн бұрын

    Module scripts are basically like installing a library if you were using a different programming language like for example python. Saying "import time" would give you a similar item with functions to use in your code. This lets you do the same where you define it yourself. It also means you can use module scripts from the toolbox in your code as you just require it and get all of these functions readily available, which may be used for advanced usages such as api calls from services outside of roblox.

  • @kingswag7
    @kingswag74 ай бұрын

    Module scripts for scripting advanced stuff ❌️ Module scripts for settings ✔️

  • @raininthesedan

    @raininthesedan

    4 ай бұрын

    Tbh I do both, module scripts for OOP is great and settings too Also great to use for cross script shared data like player data

  • @execute214

    @execute214

    4 ай бұрын

    module scripts for OOP ❌ (OOP sucks) module scripts for modular programming ✔

  • @vyntax.mp3

    @vyntax.mp3

    4 ай бұрын

    @@execute214 yessir.

  • @raininthesedan

    @raininthesedan

    4 ай бұрын

    @@execute214 not if u use it right or use an OOP game framework like knit

  • @user-zs1hm1cy8u
    @user-zs1hm1cy8u2 ай бұрын

    This is very useful for when you have multiple objects that share functionality. More easy to maintain and upgrade.

  • @YGM-
    @YGM-4 ай бұрын

    That was really helpful thank you

  • @AfonuOfficial
    @AfonuOfficial4 ай бұрын

    good hook, nice video, good explanation, keep them videos coming 😍

  • @Dann.y
    @Dann.y4 ай бұрын

    Love your thumbnail designs

  • @SirJo_
    @SirJo_4 ай бұрын

    I absolutely love your teaching style, it's feels so much more natural while everyone else just seems *scripted* !

  • @eazyaviation
    @eazyaviation4 ай бұрын

    I love modulescripts, they makeme seem cool by making things that are really easy to do, 10x more complicated

  • @nebularzz
    @nebularzz4 ай бұрын

    ModuleScripts are actually more like functions with their main purpose being returning more functions that you will need however you can put anything from a normal script into that modulescript and it will work like a normal one except you have to require it example: local module = {} function module.add(...) -- sample function local result = 0 local numbers = {...} for i,v in pairs(numbers) do result += v end return result end print("ModuleScript required!") -- This will print when the modulescript gets required return module

  • @haxking2352
    @haxking23524 ай бұрын

    As soon as I learnt how to use modules 99% of my scripts became module scripts and my server scripts became like 2 lines long (referencing ReplicatedStorage or ServerScriptService and then requiring a module or 2) Idk if I’m going overboard tbh

  • @cactisiusninja

    @cactisiusninja

    4 ай бұрын

    I have the same situation basically

  • @thetable8175

    @thetable8175

    4 ай бұрын

    That's normal that's just the pure essence of object oriented programming

  • @arisethee

    @arisethee

    4 ай бұрын

    That is poor, and should not be practiced, are you trying to kill the Engine? Or are you trying to make updating your own frameworks lacklustre? - I can't express enough about how people say they know how to OOP but at the same exact time completely ruin their own code, and the whole premise behind it.

  • @haxking2352

    @haxking2352

    4 ай бұрын

    @@arisethee ok… then how should it be done?

  • @arisethee

    @arisethee

    3 ай бұрын

    @@haxking2352 Instead of asking others how to do it, how about actually taking time out of your day to improve on it yourself.

  • @Ethical_1
    @Ethical_14 ай бұрын

    bro, tysm. alvin bloc didn’t explain it very well but you did the job. it pays well to be a 5 year old!

  • @caden4162
    @caden41624 ай бұрын

    omg ty i love videos titled like this

  • @Meowtsun
    @Meowtsun4 ай бұрын

    Nice for simple explaination Also nice ModuleScript icon I wonder who draw it

  • @progargantua
    @progargantua4 ай бұрын

    Bro I love your tutorials. I have not found any other channel where all the scripting stuff is explained so comprehensively and easily for my smooth brain to understand. Is there any chance you could make a tutorial on making a melee fighting system or something like that? We are trying to make a game with my friend but we are struggling so much to figure this out.

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Maybe in the future. A melee system is simple, just learn about how to use raycasts

  • @uliveulearnandregret
    @uliveulearnandregret4 ай бұрын

    I knew about this for 6 months now, just wanted to see how you explain it

  • @snefinho
    @snefinhoАй бұрын

    best tutorial ever!!

  • @lirpa6575
    @lirpa65754 ай бұрын

    I’m exactly like you. I’ve been scripting for 2 years but i only started using modules a few months ago. They’re game changing

  • @arisethee

    @arisethee

    4 ай бұрын

    2 years? Are you sure, what exactly have you been exploring? Definitely nothing programming wise.

  • @lirpa6575

    @lirpa6575

    4 ай бұрын

    @@arisethee not exactly 2 but I didn’t take it seriously for a while.

  • @lirpa6575

    @lirpa6575

    4 ай бұрын

    @@arisethee it’s because after a while I got scared of learning new stuff for some reason. So I stuck to the basic stuff I had and made games purely for fun. It wasn’t that long ago that I realised that this was something more serious

  • @arisethee

    @arisethee

    3 ай бұрын

    @@lirpa6575 Best to just challenge yourself constantly, regardless of the hardship, use the documentation, don't use tutorials for learning but instead gaining knowledge.

  • @unevenvalues
    @unevenvalues4 ай бұрын

    thanks, i was really confused

  • @patricknorthcutt4052
    @patricknorthcutt405228 күн бұрын

    Very simple concept. I did not see you mention the DRY principle. DO NOT REPEAT YOURSELF. If you have a method used in several scripts, instead of cut and paste, refactor the code and put the reused part in a module script. This is a basic Object Oriented principle. Good video on how to use it, I think the why could use some work. Perhaps you could put out another video where you found a reused method. Show people how to use a module script to eliminate the redundancy.

  • @YTFTASH
    @YTFTASH4 ай бұрын

    Also you should note that: "you could add as much module scripts as you'd like, because they don't affect performance." Unless multiple/many scripts are running and using the modules.

  • @arisethee

    @arisethee

    4 ай бұрын

    Someone need's to teach you how the Roblox Engine read/store/execute's data.

  • @YTFTASH

    @YTFTASH

    4 ай бұрын

    @@arisethee Uh, no? since I've been using what other people say and it just works with what I do as well..

  • @GalaxinTM

    @GalaxinTM

    4 ай бұрын

    lol if you didn’t know, the Roblox app’s interface is written in Luau, and those use hundreds of module scripts and it runs just fine

  • @yarik_superpro
    @yarik_superpro4 ай бұрын

    module script is giving you one value once you require it,that it

  • @tenodgosnika9635
    @tenodgosnika96354 ай бұрын

    i tbh use it mostly for sharing same tables with client and server

  • @Ismail_NotFullName
    @Ismail_NotFullName4 ай бұрын

    Can't these be used like classes, kinda like stuff from GDScript or Java. Basically you could have an Entity ModuleScript, and have all of your entities require it so that they all share common variables and functions. The cool part is that you could make another ModuleScript that requires the Entity ModuleScript and Override the ModuleScript's initial stuff so you can customize it for something else. Ex: A dog ModuleScript extending from Entity The upside to this method is that it allows you to create some really cool stuff using inheritance and composition like StateMachines pretty easily. Although I could be wrong here. It's been like 3 years since I've touched roblox studio lmao

  • @ashtondrye102
    @ashtondrye1024 ай бұрын

    It is a function that has no inputs but, it returns, and can only be called using require(f)

  • @pilottim136
    @pilottim1364 ай бұрын

    i love your teaching style but module scripts seem pretty useful now lol

  • @Xrthix
    @Xrthix2 ай бұрын

    so basically, you can use it like a normal function, but with extra steps BUT more organized?

  • @danzstuff
    @danzstuff4 ай бұрын

    thank you!

  • @Techyplains
    @Techyplains4 ай бұрын

    I've actually been scripting for around 6 years, and I never have constructed a module script. Ever. Thanks for the info!

  • @cactisiusninja

    @cactisiusninja

    4 ай бұрын

    6 years??? I would be dead without them

  • @scriptabledrawing7773

    @scriptabledrawing7773

    4 ай бұрын

    Same I’ve been coding for 6 years and only started using them a year or 2 ago

  • @freerobux49

    @freerobux49

    3 ай бұрын

    i started using them like a month into it 😭

  • @Sanker1
    @Sanker13 ай бұрын

    That's pretty cool

  • @thejahoobasdeveloper
    @thejahoobasdeveloper4 ай бұрын

    I've been scripting for 7 years and didn't know how to use these until i watched this lmao

  • @RobluxDev
    @RobluxDev4 ай бұрын

    NOTICE: do not put server sided modules outside of a server sided area otherwise exploits can read the file

  • @brickwall2900
    @brickwall29004 ай бұрын

    object oriented programming in roblox?

  • @oiimmegadonuts.4362
    @oiimmegadonuts.43624 ай бұрын

    All hail byteblocks!

  • @maxdigiacomo4608
    @maxdigiacomo46083 ай бұрын

    They can also return functions

  • @JuanDyAir
    @JuanDyAir3 ай бұрын

    2 years? 😨 i starrted making a random obby game like 4 years ago, where i didnt know wjat anchor is, crazy ur still smarter than me

  • @everlastingproductions7489
    @everlastingproductions74894 ай бұрын

    Module scripts run without call from another script. Only the functions inside the return statement are not used at runtime

  • @kanapuro
    @kanapuro4 ай бұрын

    oh cool i wanted to learn a little more about these.

  • @MLMML171
    @MLMML1714 ай бұрын

    as a 500 year old, i can confirm this is a very good tutorial

  • @fierzy_
    @fierzy_2 ай бұрын

    As a 5 year old, module scripts now make sense! (seriously tho, ty for the explanation)

  • @bbnmm8720
    @bbnmm87204 ай бұрын

    i was gonna say "lol there is someone that doesnt know how an simple modulescript works :o" but i cant judge as my experience learning and studying is better than most people as i had good developers also front-page helping me with good oportunities and doubts in general and i also had knowledge in python, c, javascript,html ( all basic but still nothing ) and i got an good mind to learn in general good didact, i feel its impossible to someone not understand how u explained lol, i like to think scripts as an paper with their functions written in and an modulescript would be taking an paper from an box and then reading their information and then using in another paper, other script, i also like think about other things as the same concept sadly most of roblox developers lack alot in knowledge and its why they understand something simple like that or even dont have maturity or simple dont know how to study, but well i can't complain, i already tried to help lots of people with my knowledge most of them dont want to be helped

  • @daxcisionxd
    @daxcisionxd4 ай бұрын

    Funny thing is i was recently looking up what module scripts are specifically

  • @Fallen_Prince69410
    @Fallen_Prince694104 ай бұрын

    Can you make a video how to make a role that requires a badge

  • @DFGH6
    @DFGH64 ай бұрын

    Can you do a tutorial for 4 years old? I can't wait till I turn 5

  • @PabTSM-OfficialChannel
    @PabTSM-OfficialChannel4 ай бұрын

    aka: modulescripts are scripts that return a value once required, usually which returns a table containing variables but you can make it return anything

  • @k_otey

    @k_otey

    4 ай бұрын

    this is useful if you want modular code; you can store functions in modulescripts and thus code can be reused anywhere

  • @hhb9900toll
    @hhb9900toll2 ай бұрын

    thanks

  • @GSFigure
    @GSFigure4 ай бұрын

    ModuleScripts are the reason I still have hair on my head, because without them I would probably go insane trying to rewrite code for every script because of data being moved around.

  • @lolmasterwastaken2
    @lolmasterwastaken24 ай бұрын

    What can these be used for?

  • @mangoferanous
    @mangoferanous4 ай бұрын

    OMG ITS LIKE A FUCKING CLASS!!! THANK YOU! MY 5YO BRAIN UNDERSTAND NOW

  • @skulls3042
    @skulls30424 ай бұрын

    I’m pretty sure I heard something about them being useful for larger amounts of data like inventories and characteristics-pets, tools, etc. I could be wrong though, it’s been a while. 😅

  • @thisisclearlymyusername12
    @thisisclearlymyusername124 ай бұрын

    now make a tutorial on OOP (Metatables, inheritance, polymorphism, etc...) and also, a modulescript doesn't have to return a table (it can return a function, integer, etc...)

  • @iplayminecraft2248
    @iplayminecraft22484 ай бұрын

    so module scripts are basically like libraries for c++ where you can write some simple functions (like cout) and then include them in your regular script without having to copy-paste all those functions over?

  • @freerobux49

    @freerobux49

    3 ай бұрын

    yea

  • @Grillkol
    @Grillkol4 ай бұрын

    i have been using only modulescript for the past year, and i can confirm that module is table.

  • @DonTeuni
    @DonTeuni3 ай бұрын

    0:09 seconds in and I already didn't understand it, might making 1 1 to explain ModuleScripts if I were a 2 year old?

  • @reminderIknows
    @reminderIknows4 ай бұрын

    i don't think that a module script is a table i think it more like a function that always returns something you have to use the require() function, which makes it act like a function

  • @freerobux49

    @freerobux49

    3 ай бұрын

    literally the first line in any module script you make defines a module variable as a table which is then returned at the end of the script

  • @NovInked
    @NovInked4 ай бұрын

    So tell me if i'm wrong... But this means you can put loads upon loads of variables and functions inside the module (that you've attached to a script) And you can just script on a local or server scale without writing variables and functions inside those because you already made them inside the module??? (What i'm trying to say is that the module serves as a library that you yourself made) If that's the case it's huge, very helpful because you don't need to scroll within 6 different scripts and more than 500 lines just to find your function or variable 😂

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Basically yeah, modules are meant to be used as libraries

  • @NovInked

    @NovInked

    4 ай бұрын

    @@byteblox100 thanks for confirming, i put my head into coding like a month ago (since i was maining animations and vfx) and i was getting annoyed by the amount of time it took for to just go through a lot of lines and different scripts just to find functions and variables. Thx again, i don't think i would've found this.

  • @gor_supervisor
    @gor_supervisor3 ай бұрын

    Module scripts are similar to JSON functionality wise then

  • @piercegames4577
    @piercegames45774 ай бұрын

    Bro me too I have been scripting for 2 years and I just recently found it

  • @Dogeloper505
    @Dogeloper5052 ай бұрын

    hey man, I've been wondering for some time now, but how can i make a script that affects 1 player, example: A player touches a part and a sound will start playing, it only plays for the player whom touched the part and not other players.

  • @byteblox100

    @byteblox100

    2 ай бұрын

    Local scripts lol

  • @binkledev
    @binkledevАй бұрын

    im still in the womb and thanks for the video

  • @HenriqueVolkov
    @HenriqueVolkov4 ай бұрын

    So basically, if you have a bunch of tools or some type of system like a combat one and you have scripts that have a lot of functions, instead of having all of the into each script i could just have all of them into a module? For what i undertood, this would make it so much easier if theres a bug on the system because you wouldn't need to go on each script to fix that, right? Please tell me if i understood that right...

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Basically yeah. Modules just give you a table with whatever functions you add to them, and this table can be accessed by any script

  • @El_kimen
    @El_kimen19 күн бұрын

    I feel like an old man saying "But that wouldn't be so much useful, i'd prefer to use the old way"

  • @Riv3rz
    @Riv3rz4 ай бұрын

    Byte!!! I wrote my first script without using a tutorial!!!

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Awesome. Now recreate the entirely of Arsenal

  • @Riv3rz

    @Riv3rz

    4 ай бұрын

    @@byteblox100 as you wish master

  • @crsenthusiast
    @crsenthusiast4 ай бұрын

    do cframes next

  • @LuckyEcho
    @LuckyEcho4 ай бұрын

    Is this channel just where you like as you learn scripting yourself, you are posting tutorials on what you are learning? Because if it is, I would recommend going a little more in depth about what it is, and where it can be used, etc... plus you learn more!

  • @byteblox100

    @byteblox100

    4 ай бұрын

    It’s both. I share what I’ve recently learned, and share what I learned like two years ago

  • @koalaeater69
    @koalaeater694 ай бұрын

    do they run on the server or locally? or maybe is it the same as the script that requires it? this could help me with a game

  • @byteblox100

    @byteblox100

    4 ай бұрын

    It’s the same as the script that requires them. Modules are literally just tables, you can use them on either script

  • @koalaeater69

    @koalaeater69

    4 ай бұрын

    @@byteblox100 ok that makes sense

  • @TheMrShowerMan
    @TheMrShowerMan4 ай бұрын

    A module script is just a function that only runs when you call require() on it, but it only runs once, so every other time you call require() it gives back the result it got the first time.

  • @freerobux49

    @freerobux49

    3 ай бұрын

    its not that it only runs once, it's just that there's no point in requiring a specific module script more than one time in a single script

  • @TheMrShowerMan

    @TheMrShowerMan

    3 ай бұрын

    @@freerobux49 by runs once I mean it runs once per machine, not per script

  • @Dann.y
    @Dann.y4 ай бұрын

    A module script is basically a .dll but I Roblox.

  • @catatrophicalist
    @catatrophicalist3 ай бұрын

    can you explain me the difference between function module:something() and module.something = function()?

  • @byteblox100

    @byteblox100

    3 ай бұрын

    No difference

  • @windy6191

    @windy6191

    Ай бұрын

    mode:something() would be module.something = function(self) ‘:’ is used for methods which are functions that pass the table that the function in as the first arguement

  • @Arethuxia
    @Arethuxia2 ай бұрын

    I still don't understand, Do I need to be 5 years old to learn this cuz I'll have to wait 1 more year.

  • @pablitodies
    @pablitodies4 ай бұрын

    how do i require a modulescript on a localscript? is it the same thing

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Same exact thing

  • @thebananapants
    @thebananapants4 ай бұрын

    Can you do a tutorial explaining it to a 2 year old? I barely understood this one 😍

  • @Nahwap

    @Nahwap

    4 ай бұрын

    It's basically a table which contains functions or values and it only runs when you use "require()" on it

  • @TjSgRf
    @TjSgRf4 ай бұрын

    I WAS THE 1100TH LIKE!

  • @Anon-zq5bo
    @Anon-zq5bo4 ай бұрын

    gave me a bit of javascript vibes there

  • @user-md7yt2sw2s
    @user-md7yt2sw2s9 күн бұрын

    bro functions are litteraly functions in lua butf can be shared across multiple scripts and data. you can index the functions and object within them to make things easier how the hell is this hard this is baby. im suprised, normal scripts are slighly challenging.

  • @yellowfirx0
    @yellowfirx04 ай бұрын

    Can you explain "return" as if we were 5, no matter how much searching I did I still can't undestand it very solidly 😖😖

  • @freerobux49

    @freerobux49

    3 ай бұрын

    the most simple explanation of the return method possible is as follows: calling a function that returns a value (i.e 'return "String"' or 'return 5') essentially causes that function call to be replaced by the value that is returned. for example; if you had a function who's only purpose is to return the number 5, then using the print() method with the function call as a parameter would output the number 5.

  • @IcyPickleYT
    @IcyPickleYT4 ай бұрын

    This is literally module.exports from JavaScript 😭😭🙏

  • @blocky074
    @blocky0744 ай бұрын

    Goo goo ga ga

  • @Ydhtcmo001
    @Ydhtcmo0014 ай бұрын

    How do i dettect when a value from a module changed?

  • @byteblox100

    @byteblox100

    4 ай бұрын

    A value will only change if you change it via a script. So if something needs to happen when a value changes, just do it after you change the value

  • @Ydhtcmo001

    @Ydhtcmo001

    4 ай бұрын

    @@byteblox100 when i put While wait () do If MPmol.ArmorHealth Script.Parent.ArmorBreak:Play() End End It works, but i have to put it in a separated script, is there anyway to make it withot while wait() or repeat?

  • @byteblox100

    @byteblox100

    4 ай бұрын

    Honestly I’d recommend removing the value from the module script and instead using an IntValue instance, which has a .Changed event that fires whenever its value changes

  • @Alberto0432
    @Alberto04324 ай бұрын

    cool, that could be used as a database script

  • @TheCoconutKid
    @TheCoconutKid4 ай бұрын

    Now i have information i dont need

  • @b_mbyz
    @b_mbyz4 ай бұрын

    i think its worth pointing out that module scripts can be directly used as a function if the script is written like bellow module script: return function() blebleble end server script: local func = require(modulescript) func() this is pretty useful is ur simply tying a single function to an object that is cloned. a good example of this i found is in the game Juke's tower of hecc (jtoh) which has levels stored on the server which are cloned to each individual client making the game practically single player (even if u are playing on a server). if u look into its map making kit all the custom objects like buttons, morphers speed changes etc. youll find that each of those objects contains a module script that usually just contains a function as a set of instructions on what to do when the player interacts with them

  • @Volt09
    @Volt09Ай бұрын

    THE PURPLE SCRIPT OF DOOM

  • @conkerious
    @conkerious4 ай бұрын

    i thought he would explain ZonePlus module script

  • @punchthecake82
    @punchthecake824 ай бұрын

    Clickbait, it didnt start as "Once upon a time" and didnt refer values and nerdy verbs as Rabbits, Apples and neither Princess. My 5 year old daughter got bored and went out to the lego bar to eat and drink legos. She choked on one and died, its all your fault.

  • @user-nu1qq9nj5n
    @user-nu1qq9nj5n4 ай бұрын

    Leave a comment

  • @yaynt
    @yayntАй бұрын

    instructions unclear im 4

  • @discussions.
    @discussions.4 ай бұрын

    Me who already knows what module scripts are and is just watching because I'm bored:

  • @CfoeQ
    @CfoeQ4 ай бұрын

    i left a comment

Келесі