Stop Repeating Yourself! Improve Your Code with Collection Service

Get the plugin here: www.roblox.com/library/948084...
MERCH ► shop.gnome.codes/
DISCORD ► / discord
TWITCH ► / gnomecode
TWITTER ► / gnomecoderblx
WEBSITE ► gnome.codes/

Пікірлер: 232

  • @galicate
    @galicate8 ай бұрын

    Should be noted that you no longer need the CollectionService plugin, as it has been officially added to roblox in the View tab.

  • @grape-wtf

    @grape-wtf

    Ай бұрын

    It makes it easier with the world view

  • @Ph4ntomize
    @Ph4ntomize9 ай бұрын

    These are the habits that more people should be spreading awareness of.

  • @neut_ro

    @neut_ro

    9 ай бұрын

    I found you here too?! Cool

  • @schloomy

    @schloomy

    9 ай бұрын

    oh hey ph4ntomize

  • @Cogrem

    @Cogrem

    9 ай бұрын

    Oh hey

  • @findrandomshithere

    @findrandomshithere

    9 ай бұрын

    dear sweet jesus you're alive

  • @bloxthebloxxer8234
    @bloxthebloxxer82349 ай бұрын

    NOTE: if you encounter bugs with it try to make sure none of the variables you are making are global because that really messes with everything alot

  • @_snekmatt-xt5ch

    @_snekmatt-xt5ch

    8 ай бұрын

    Outside the loop or in?

  • @coreydorce8246

    @coreydorce8246

    3 ай бұрын

    Generally anywhere, you shouldn't use global unless you have to reference it in another script for some reason

  • @Gavriasagmaeilll
    @Gavriasagmaeilll6 ай бұрын

    i suggest not trying to use workspace as a whole, because player models will exist in there too, and if their displayName is the same as a tag...then that changes a lot about the player in question

  • @Someone-df3tv
    @Someone-df3tv7 ай бұрын

    Exactly what I had been searching for. Thank you!!

  • @ahmetselimgt3232
    @ahmetselimgt32326 ай бұрын

    More of this series please

  • @RansomwaveRBLX
    @RansomwaveRBLX8 ай бұрын

    didn't know about that, thank you man!

  • @ANSU12321
    @ANSU123218 ай бұрын

    This video really helped with my original simulator

  • @thatyoutubeguy-md2ws
    @thatyoutubeguy-md2ws19 күн бұрын

    Bro, I needed This Tutorial ♥ it took me so long to find a good tut like this one 💀💀💀💀

  • @franzhaydenferrer
    @franzhaydenferrer8 ай бұрын

    I’m going to use this for UI button sounds. Thanks!

  • @AReallyStupidName
    @AReallyStupidName21 күн бұрын

    This video saved me from copy and pasting 840 times thank you so much 😊

  • @OHWAVIDA
    @OHWAVIDA7 ай бұрын

    unironically saved me a huge headache

  • @12Duckz
    @12Duckz9 ай бұрын

    Gnome always with a helpful video, keep up the good videos man.

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    Thank you!

  • @King_NaymarosReal

    @King_NaymarosReal

    9 ай бұрын

    ​@@GnomeCodecan you show how to use messaging service i want to make global shop stock, and wonder how it works. Hope you will help

  • @PhantomsCreations
    @PhantomsCreations9 ай бұрын

    Gnome sir you explain so good but how do you have so much less subs you should reach 1 million!

  • @SHOIOTERB
    @SHOIOTERB3 ай бұрын

    Thank you very much, now I can make my Sci-Fi doors of my game work on that

  • @m3s5_0f_numb3r5
    @m3s5_0f_numb3r57 ай бұрын

    I used to do this when i first started programming. It. Was. HELL.

  • @kingofgameing107
    @kingofgameing1079 ай бұрын

    this video is so helpful

  • @AReallyStupidName
    @AReallyStupidName21 күн бұрын

    This video saved me from copy and pasting 840 times tysm

  • @devuskasolnce21
    @devuskasolnce219 ай бұрын

    hey bro nice video !!! but by the way remember ? about doors ? you made the last episode is 7 about how to make doors in roblox studio so maybe you should continue making video about how to make doors in roblox studio ?

  • @tedbasher3000
    @tedbasher30008 ай бұрын

    I usually just handle it on the client via a local script. However one time I was making a FE2 game, and in that one I just put a script that loads a module script with the code

  • @LeapInno
    @LeapInno5 ай бұрын

    Ohh now this makes more sense.

  • @Yan-ol4qu
    @Yan-ol4qu2 ай бұрын

    OH MY GOD I LOVE YOU.

  • @threasto
    @threasto9 ай бұрын

    I never use collection service enough, but it is pretty handy. I personally just throw any object of a certain type (ie doors) into a folder called doors and loop through them instead

  • @MarzFromMars

    @MarzFromMars

    9 ай бұрын

    Same

  • @AverageFries

    @AverageFries

    9 ай бұрын

    same

  • @treyg5265

    @treyg5265

    7 ай бұрын

    same

  • @noobdev10

    @noobdev10

    6 ай бұрын

    Not very convienent, in my situation i have to use over 5 for loops..

  • @FidLine1erDunom
    @FidLine1erDunom5 ай бұрын

    Thank for the video

  • @Spork2
    @Spork29 ай бұрын

    Thank you GnomeCode. I’m currently making a game and you have no idea how helpful this is 😅

  • @thew219
    @thew2199 ай бұрын

    How do you see the tags of an instance without a plugin? I use custom attributes and check its value for scripting. I can see attributes on the properties panel but idk where to easily find tags without plugin.

  • @Objrbo
    @Objrbo9 ай бұрын

    you can make a tutorial on how to create a boss fight like the ones in item asylum

  • @ZellMC
    @ZellMC4 ай бұрын

    thanks

  • @twinn61661
    @twinn616619 ай бұрын

    The tag editor plug in is no longer needed. Robots add a tag instance in the properties window.

  • @wedoalittletrolling723

    @wedoalittletrolling723

    9 ай бұрын

    "Robots" lol

  • @twinn61661

    @twinn61661

    9 ай бұрын

    typo I meant Roblox, :)@@wedoalittletrolling723

  • @Fezjk
    @Fezjk9 ай бұрын

    please make a rts game tutorial

  • @Blade3337R
    @Blade3337R9 ай бұрын

    your tutorials are amazing dude, thanks to you i actually know quite a bit about coding now.

  • @lucagamer5620
    @lucagamer56209 ай бұрын

    thank you. This is a very helpful video, everyone should know to do these. I've looked so much on how to do this. I really appreciate this, keep the work and don't give up. Also you should make a remake of your Tower Defense, maybe with rng, many people will look at a tutorial such it!

  • @Aiden_gue
    @Aiden_gue9 ай бұрын

    omg omg omg omg ty ty ty ty

  • @harrow7533
    @harrow75336 ай бұрын

    what about For i loops you could also use that

  • @SigmaBGE
    @SigmaBGE9 ай бұрын

    Hello! you can make a tutorial on how to make Doors HOTEL UPDATE in roblox studio

  • @yes.5110
    @yes.51109 ай бұрын

    how to make a purchase prompt for catalog items and clothes appear when text button gui is clicked

  • @demtix4381
    @demtix43819 ай бұрын

    Thanks for making this

  • @B00PZIES
    @B00PZIES2 ай бұрын

    I’ve been using another method such as grouping the similar models together, and looping through them all. Is it better to use collection service? Is there issues with my method?

  • @yeetmanmega
    @yeetmanmega9 ай бұрын

    are you back from your break?

  • @nie_powiem
    @nie_powiem7 ай бұрын

    Hey gnomecode how to we use collection services on kill parts?

  • @bradleywhais7779
    @bradleywhais77795 ай бұрын

    I learned you dont need pairs() or ipairs() anymore because luau now has general iteration. :(

  • @GigaGnome
    @GigaGnome9 ай бұрын

    Upload grind recently.

  • @guygameguy5548
    @guygameguy55489 ай бұрын

    This is so helpful!

  • @pxul1
    @pxul19 ай бұрын

    Nice, short and entertaining video!

  • @TrollMonster24
    @TrollMonster248 ай бұрын

    Is there any way to make this A touched function?

  • @itz_ult
    @itz_ult9 ай бұрын

    There’s a different way I like to do it using folders

  • @A10Rooms
    @A10Rooms9 ай бұрын

    bro said no doors

  • @hooppss
    @hooppss9 ай бұрын

    Could you do a tutorial of a turn based system? I've been looking for some a long time.

  • @PizzaMoose

    @PizzaMoose

    9 ай бұрын

    I agree! It would be so cool to learn how to make one!

  • @chillgamer3485
    @chillgamer34859 ай бұрын

    Hey GnomeCode, could you show us how to make a turn based fighting game similar to Adventure Story? It would be awesome!!

  • @mmd4369
    @mmd43699 ай бұрын

    This is actually sick! Gnome, how did you learn coding?

  • @jimikalliopuska9421
    @jimikalliopuska94219 ай бұрын

    Please finish the doors series

  • @OfficialNormalPerson
    @OfficialNormalPerson9 ай бұрын

    Thank you so much!

  • @wedoalittletrolling723
    @wedoalittletrolling7239 ай бұрын

    Just copy and paste them, or use Package system to make the door a package, so if you change the door's script, and update the changes it should update all doors in the place. You could also put the door in a storage service (ReplicatedStorage or ServerStorage) and clone them to a position on the map.

  • @miles1094

    @miles1094

    9 ай бұрын

    It makes more sense to have your scripts either in server script or player scripts. They should never be in a model. It keeps things organized and maintains a good workflow

  • @wedoalittletrolling723

    @wedoalittletrolling723

    9 ай бұрын

    @@miles1094 So how about NPCs? Do i have to use OOP or even use for loops to make something like a enemy NPC that shoots you with a weapon? I can understand AI navigation, but what about aiming, shooting weapon, and all that misc stuff? 99% of NPCs with weapons i came across in toolbox have their scripts inside the model, and yeah sure non roblox NPCs are handled differently like they have seperate classes for them, like behavior, weapon handling, etc but this is roblox

  • @mysyvcic

    @mysyvcic

    9 ай бұрын

    ​@@wedoalittletrolling723I use CollectionService and ModuleScripts for my AI's, and when I did a stress test with 30 of them i mostly get 45-50 fps and my PC is pretty much a low-end pc. And when all my AI's had separate scripts it made me get 20-30 fps.

  • @mysyvcic

    @mysyvcic

    9 ай бұрын

    ​@@wedoalittletrolling723Plus my AI's can actually attack

  • @PolyTheDude

    @PolyTheDude

    9 ай бұрын

    @@wedoalittletrolling723 That doesn't mean theyre good 99% of those npcs are outdated and not very optimized Now you could have scripts in your npcs and still have them optimized, but generally itd just be better to have one script manage multiple npcs instead of multiple scripts managing their respective npcs Aiming, shooting, etc, just use modulescripts brah

  • @DrizzyB
    @DrizzyB6 ай бұрын

    Can someone explain the original moving door script to me, specifically the "function MoveDoor(isOpen)" thing? I'm not understanding the argument of "isOpen" and how it's pertaining to the function. I know that arguments send information that is out of scope of a function to said function, but what information is "isOpen" sending? Does the "isOpen" attribute need to be applied to the model in order for the door to move? What about when the attribute is set to "not isOpen" after the proxim prompt is triggered? The door can still be moved after it's opened (closing the door). What does "local isOpen = model:GetAttribute("isOpen")" even mean?

  • @gunipotys

    @gunipotys

    5 ай бұрын

    If the door should be open or not, if it should, then it reacts a way, if it shouldn’t, then it react another way. Also, the last line just get the value of the attribute.

  • @georgepg3d854

    @georgepg3d854

    4 ай бұрын

    Its advanced scripting stuff and it seems like you dont understand it,but dont worry just practice more!And believe me studying better is better than studying more,so if you find scripting tutorials that you perfectly understand youre good to go!😊

  • @nikushahd
    @nikushahd9 ай бұрын

    Thx

  • @gavinhoh7218
    @gavinhoh721819 күн бұрын

    How do you do this with zombies

  • @grinderandrew
    @grinderandrew5 ай бұрын

    question:how do you make the sliding door is it in the toolbox?

  • @SHOIOTERB

    @SHOIOTERB

    3 ай бұрын

    There can be grammar mistakes so I hope you know how to fix my grammar (Put the Tween:Play() somewhere in a function like Script.Parent.ProximityPromt.Triggered:Connect(function() Tween:Play() end)

  • @complexyt4386
    @complexyt43869 ай бұрын

    I have been wondering how do this for the past few weeks this will help SO MUCH

  • @BuildPlayz
    @BuildPlayz9 ай бұрын

    I don't use collection service, nor do I use dupe scripts. Instead I put them in a folder and for the loop I do folder:get children instead of collectionservice:get tagged but both work

  • @xgodtoxi2978

    @xgodtoxi2978

    9 ай бұрын

    same

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    This works well until you want to organise your folder structure differently. What if your doors are inside a building? You would probably want them to be inside the folder/model for that building rather than in their own separate doors folder. CollectionService allows you to easily access all the tagged elements rather than relying on a specific folder layout.

  • @BuildPlayz

    @BuildPlayz

    9 ай бұрын

    @@GnomeCode ooo good point imma start using this

  • @KingDuckTheGreat

    @KingDuckTheGreat

    9 ай бұрын

    I was doing this too but now that I know this exists I will be using collection service

  • @the_yelo
    @the_yelo9 ай бұрын

    Thank you mr gnomecode!

  • @Tdz802
    @Tdz8029 ай бұрын

    Can you make a tut On how to Make a Tds Game??

  • @thingytb7458

    @thingytb7458

    9 ай бұрын

    he already did

  • @Tdz802

    @Tdz802

    9 ай бұрын

    @@thingytb7458 I Mean like a New Tut Sense this one does not work

  • @eduerob1012
    @eduerob10129 ай бұрын

    Do a Tower Defense again plssssssssssss

  • @Puzzledmusel86
    @Puzzledmusel869 ай бұрын

    I never knew what this was before this video :)

  • @Colognn
    @Colognn9 ай бұрын

    will you continue the Noors tutorial? are you planning on make other tutorials also?

  • @sebalby34

    @sebalby34

    9 ай бұрын

    Noors

  • @VeryProPlayerYesSir1122

    @VeryProPlayerYesSir1122

    9 ай бұрын

    @@sebalby34 *Doors

  • @madzhis7076
    @madzhis70769 ай бұрын

    Very useful, ive had enough of changing scripts in 20 different models

  • @gugglyguggerson
    @gugglyguggerson9 ай бұрын

    hey, i have a few video suggestions. you know your custom characters video (not the morph one)? well, maybe you could show us how to code an idle animation and jump animation. also, how do you make it so an animated decal plays only for a specific animation?

  • @broko151
    @broko1519 ай бұрын

    Its helpful this thanks

  • @Daani_Duarte
    @Daani_Duarte9 ай бұрын

    Hey gnome, could you explain why do you use "isOpen" and "Close" or "Open" for proximity prompt text? Im assuming isOpen is a boolean attribute, but how does this works? The same happens at the color... Is it because, since its a boolean, if its true it will get the first parameter otherwise get the second? Appreciate, Thanks.

  • @kristof0713

    @kristof0713

    9 ай бұрын

    or gives you the first value if its not nil or false and the second otherwise. true and "close" or "open" will give you close becuase true and "close" are both true values false and "close" or "open" turns into false or "open" because false and true -> false and if the first value is false or gives back the second one Idk if this made any sense Its lua's ternary operator

  • @Daani_Duarte

    @Daani_Duarte

    9 ай бұрын

    @@kristof0713 I see... Ty, now it makes sense!! =D

  • @icetea622.
    @icetea622.9 ай бұрын

    Updated tower defense code!

  • @_G.Based_
    @_G.Based_9 ай бұрын

    I found this pretty helpful thanks!

  • @RobloxTutorialsITA
    @RobloxTutorialsITA9 ай бұрын

    where are new tutorials on how to do games?

  • @Marioman73

    @Marioman73

    9 ай бұрын

    These give you the building blocks / tools to make games!

  • @abyssguardian

    @abyssguardian

    9 ай бұрын

    These tutorials provide the building blocks for a game. You're the one who makes the game! Use these as steps if you need to. Hopefully you can create yourself a fun game!

  • @Euphoric987
    @Euphoric9879 ай бұрын

    Gnomecode make chapter 5 man I beg you make chapter 5 I LOVE YOUR GAME MAKE CHAPTER 5😢

  • @rtralph1269
    @rtralph12697 ай бұрын

    Okay so, what makes me mad is that you didn't explain the for loop for this particular topic. Can you please tell me how that works for CollectionService?

  • @Nahwap

    @Nahwap

    7 ай бұрын

    it basically gets every instance (doesn't matter if they are in the ServerStorage, ReplicatedStorage, Workspace, etc) with the tag you are looking for. For example, it's very good if you want to handle AI's because you dont need a single script inside every npc or every npc inside a single folder

  • @computerheadman1601
    @computerheadman160117 күн бұрын

    No one is gonna mention the creator named sweetheartichoke xd?

  • @riristudio6440
    @riristudio64409 ай бұрын

    I was waiting for this Exact tutorial.

  • @nomanhai
    @nomanhai9 ай бұрын

    Hey man your one of my favorite youtuber can u do a 'teddi' series. Its a very underrated game so u may have not heard about it

  • @sebalby34

    @sebalby34

    9 ай бұрын

    He made teddy

  • @ProdByJuice.
    @ProdByJuice.9 ай бұрын

    this is MAD useful and easier

  • @MisledAnon
    @MisledAnon9 ай бұрын

    Thank you.

  • @miffclick3358
    @miffclick33589 ай бұрын

    Python To Roblox To Skidibi Da Da Doo Skibidi Di Daw

  • @jukepilot
    @jukepilot9 ай бұрын

    Mr Gnomecode, you should make a video about making lore!

  • @sebalby34

    @sebalby34

    9 ай бұрын

    ... bro lore is a story element in your game, u dont need scripting for lore, lore is story and you decide it, u dont need a tutoeial to make up a story

  • @gerjovogelfotografie5826
    @gerjovogelfotografie58264 ай бұрын

    How does the script knows what ''model'' is? (parameter on 4:55)

  • @0_Stevqxx1

    @0_Stevqxx1

    3 ай бұрын

    Because you told it to look at any model that has sliding door tag

  • @0_Stevqxx1

    @0_Stevqxx1

    3 ай бұрын

    Also "model" is a variable so you can change it to what ever you want like name it "door"

  • @0_Stevqxx1

    @0_Stevqxx1

    3 ай бұрын

    Sorry i thought you asking about the model that is in the for loop, in the parameter because you add the function movedoor to the for loop and told the script that you want it to work on the model and isopen using the parameter

  • @advfrogyt
    @advfrogyt9 ай бұрын

    I like how he finished the 5th doors tutorial then stopped

  • @weirdguylol
    @weirdguylol9 ай бұрын

    We getting out of the metaverse with this one! 💪💪💪💪💪💪💪💪💪💪🤳🤳

  • @eliteengineer7340
    @eliteengineer73409 ай бұрын

    I dont use collection service , but i dont duplicate doors with scripts either, i would probably put parts to be replaced with the actual door asset when the game is launched, and used a module for the client to open doors

  • @ahmoin

    @ahmoin

    9 ай бұрын

    I would create a separate folder with doors and use a for loop

  • @wedoalittletrolling723

    @wedoalittletrolling723

    9 ай бұрын

    That's actually what many games outside of Roblox do, they just have a door as an asset and when game is launched and the level loaded, it will spawn the door assets at their respective positions and have their logic setup by a class. Same goes for NPCs, interactables, player spawners and in-fact, Roblox's engine works same way since the basic parts and stuff like that are all handled by engine side, it just the logic/player stuff is handled on the Lua side. Tho setting up a system like that is kinda difficult, but i assume you can utilize the Package system they have to have all assets, scripts all placed in that package, so you only have to import it once, and all updates should affect every place that has your package.

  • @eliteengineer7340

    @eliteengineer7340

    9 ай бұрын

    @@wedoalittletrolling723 i alteady made a system that has a module that can acess an asset with a directory string, its pretty cool , ex: "Models/Door/Cool Door"

  • @TheWijss
    @TheWijss9 ай бұрын

    thanks its so usefull

  • @hptheking1393
    @hptheking13939 ай бұрын

    Amazing

  • @JDV333
    @JDV3339 ай бұрын

    can you make a how to make jojo game?

  • @epixerty

    @epixerty

    9 ай бұрын

    its too hard

  • @PogoDigitalism
    @PogoDigitalism9 ай бұрын

    wouldnt it just be enough to put a script in the server script service and get the parent of the proximityprompt to get the model. This way you dont need a tagging system and only one script (that also checks whether the proximity prompt parent is a door model.

  • @wedoalittletrolling723

    @wedoalittletrolling723

    9 ай бұрын

    @@Chaneb you can't have server overload if you intent your game to be played only in Studio 😉 jokes aside, alternative to this is just to put your model with script inside of a storage and Clone() it and parent it to a position you want it to be or use OOP but that's different thing.

  • @bloxthebloxxer8234

    @bloxthebloxxer8234

    9 ай бұрын

    you can apply collection service to more things than just doors with proximity prompts, like a group of items that are similar but only slightly different that you want to change

  • @PogoDigitalism

    @PogoDigitalism

    9 ай бұрын

    @@Chaneb bruv, you are barely looping over anything lol. U only check for matching names. There is no loop in this proposal of mine.

  • @_snekmatt-xt5ch
    @_snekmatt-xt5ch8 ай бұрын

    Its not workimg...

  • @sebalby34
    @sebalby349 ай бұрын

    Thats actually really usefull, but i have a game that cant have this or some stuff will break, also i know people ask this a lot but when is episode 8 of the doors tutorial? I dont wanna risk breaking everything by changing some code

  • @jhkz
    @jhkz9 ай бұрын

    Thank you so much! It's really annoying to copy & paste every single line of code a lot of times.

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    Glad it helped!

  • @GalaxinTM
    @GalaxinTM9 ай бұрын

    Hey GnomeCode, it is no longer required to put pairs() or ipairs() to loop through luau tables

  • @insertusernamehere8125

    @insertusernamehere8125

    9 ай бұрын

    so you're saying now you can just do for i,v in something:GetChildren() do?

  • @CouldBeAnyone

    @CouldBeAnyone

    9 ай бұрын

    ​@@insertusernamehere8125Yes

  • @JoseRomero-ew2hn
    @JoseRomero-ew2hn9 ай бұрын

    Can you do hungry pig i've been waiting over 6.5 months for you to make the tutorial series and it's making me bored and tired of waiting and I want to see it right now I'm not good at waiting for stuff you know that!

  • @user-vy8nv4wk7y

    @user-vy8nv4wk7y

    9 ай бұрын

    He is bad at waiting

  • @eronimlol
    @eronimlol9 ай бұрын

    GnomeCode, why you using a plugin for tagging objects? Roblox studio have their own simple tag editor.

  • @wedoalittletrolling723

    @wedoalittletrolling723

    9 ай бұрын

    so he can infect his place with viruses

  • @Cheezyurboi
    @Cheezyurboi9 ай бұрын

    Hey gnome! Do u know how to make one of those animation games? Day 1.

  • @sebalby34

    @sebalby34

    9 ай бұрын

    Animaton games?

  • @unifores
    @unifores2 ай бұрын

    Any other game engine makes that automatically for everything...

  • @somedude0001

    @somedude0001

    Ай бұрын

    Roblox is pretty flawed

  • @epixerty
    @epixerty9 ай бұрын

    0:59 i didn't even know you could do this

  • @sabasiat_7239
    @sabasiat_72399 ай бұрын

    Elo mate! Is it possible for you to make another TDS tutorial on roblox? I feel the first one is pretty outdated.

  • @t_ownscaper
    @t_ownscaper9 ай бұрын

    114

  • @blocccrafter566
    @blocccrafter5669 ай бұрын

    Does this work for NPCs aswell whenever I make a pathfinding chase?

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    Yup, you can use this for everything!