Organizing your Game with Tags and CollectionService - Roblox Studio

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ม.ค. 2025

ความคิดเห็น • 86

  • @wokenpok
    @wokenpok 8 หลายเดือนก่อน +3

    i feel so dumb knowing that the hours i spent copying and pasting scripts was a huge waste of time. This is going to make everything easier thank you so much!

  • @jonnyramos50
    @jonnyramos50 3 ปีที่แล้ว +5

    Keep grinding bro your content is very much appreciated

  • @SurfsUpSeth
    @SurfsUpSeth ปีที่แล้ว +11

    Lol I didn't even know collectionservice was a thing. I just created object classes and pretty much built my collection service. This makes it so much easier.

    • @ugurcan9208
      @ugurcan9208 ปีที่แล้ว +1

      can u show me something about ur class

    • @ooo8188
      @ooo8188 ปีที่แล้ว

      how did you create your classes?

    • @MrChaoticCrazed
      @MrChaoticCrazed 9 หลายเดือนก่อน

      @@ooo8188Object Oriented Programming with Modules

  • @danoobking901
    @danoobking901 2 หลายเดือนก่อน

    You'd be surprised how much this helped with something entirely unrelated.
    kinda unrelated
    I wanted to make it so when you click a button, it did something, but there were a ton of buttons. I first tried a for loop, but apparently when you click it runs as many times as there are buttons, which is really buggy. I didn't want to manually type a bunch of code for each button, so this helped a lot, thanks!

  • @nathanerickson7464
    @nathanerickson7464 10 หลายเดือนก่อน

    Man, you need to keep this up, you saved my life today with this vid!

  • @Reptle_
    @Reptle_ 3 ปีที่แล้ว +1

    Best Roblox Studio youtuber on the platform

  • @stefotheguy2766
    @stefotheguy2766 3 ปีที่แล้ว +13

    I had this Problem where I needed to copy and paste the same script into a ton of tools just to make it so you cant walk over em and pick them up and now I just tag a tool and Boom! It`s Great

    • @X_Infinity8
      @X_Infinity8 3 ปีที่แล้ว +1

      You could also turn off “CanTouch” under the properties tab of the tool or it’s handle

    • @stefotheguy2766
      @stefotheguy2766 3 ปีที่แล้ว

      @@X_Infinity8 but that will make it that nothing can touch it

    • @X_Infinity8
      @X_Infinity8 3 ปีที่แล้ว

      @@stefotheguy2766 That’s CanCollide not CanTouch, CanTouch makes it so it can’t be picked up

    • @stefotheguy2766
      @stefotheguy2766 3 ปีที่แล้ว

      @@X_Infinity8 OH thats smart I thougth it was two way system it cant touch and it cant be touched I'll be doing that for my game then thanks :D

  • @BigFloppaEnthusiast
    @BigFloppaEnthusiast 9 หลายเดือนก่อน

    I don't comment often but this was really helpful with collectathon systems, I wish learned about tags sooner

  • @FghHhj-vb5ff
    @FghHhj-vb5ff ปีที่แล้ว +1

    I think ur one of the best scripters out there!

    • @BRicey
      @BRicey  ปีที่แล้ว

      Thank you!

  • @CookieSnackRhythm
    @CookieSnackRhythm 3 ปีที่แล้ว +2

    i wasn't ready for "So lets say you are building a landmine" 🤣

    • @BRicey
      @BRicey  3 ปีที่แล้ว +1

      Hey it probably made you interested, and that was the whole point. I find learning scripting with an example instead of abstract concepts is a lot easier.

    • @CookieSnackRhythm
      @CookieSnackRhythm 3 ปีที่แล้ว +1

      @@BRicey how did you learn to script?

  • @karlmarx2704
    @karlmarx2704 3 ปีที่แล้ว +4

    You had me at landmine

  • @igz5553
    @igz5553 3 ปีที่แล้ว

    high quality video 👍 needed this for knit

    • @BRicey
      @BRicey  3 ปีที่แล้ว

      Ya that knit game tutorial was super helpful, glad you could use my video to help you out!

  • @zhanfl8670
    @zhanfl8670 3 ปีที่แล้ว

    this is very useful, im subbing man

  • @snowfall_edits
    @snowfall_edits 3 ปีที่แล้ว

    commiting war crimes with the bois (great tutorial dude)

  • @Saykator
    @Saykator 4 หลายเดือนก่อน

    Thank you, it was clear

  • @adum2198
    @adum2198 3 ปีที่แล้ว +2

    Honestly, why do you have so little views and subs when you explain it so well?

    • @BRicey
      @BRicey  3 ปีที่แล้ว +6

      Because there are so little people thst want to learn in depth. The cool thing is, as time goes on, more people will get curious and join.

    • @adum2198
      @adum2198 3 ปีที่แล้ว

      @@BRicey Hopefully.

    • @rashy15
      @rashy15 3 ปีที่แล้ว +5

      @@BRicey this is true my dog actually joined in.

    • @libriumdev
      @libriumdev 3 ปีที่แล้ว +4

      @@BRicey yeah, the “scripters” who watch TheDevKing only learn this to get rich off of a simulator. Chads like us learn to become extremely well rounded programmers.

  • @EAGamers10
    @EAGamers10 2 ปีที่แล้ว +4

    For some reason, on line 3 for "Script", the line "local connections {}" gives me an error (red squiggly line) underneath the first curly bracket and I'm just confused why?
    Even the use of the word "connections" on line 18 also gives me an error too.
    Code:
    local CollectionService = game:GetService("CollectionService")
    local connections {}
    local function makeLandmine(part)
    local connection = part.Touched:Connect(function(hit)
    local character = hit:FindFirstAncestorWhichIsA("Model")
    if character then
    local humanoid = character:FindFirstChild("Humanoid")
    if humanoid then
    local explosion = Instance.new("Explosion")
    explosion.Position = part.Position
    explosion.Parent = workspace
    part:Destroy()
    end
    end
    end)
    connections[part] = connection
    end
    for _, landmine in pairs(CollectionService:GetTagged("Landmine")) do
    makeLandmine(landmine)
    end
    CollectionService:GetInstanceAddedSignal("Landmine"):Connect(function(instance)
    makeLandmine(instance)
    end)
    CollectionService:GetInstanceRemovedSignal("Landmine"):Connect(function(instance)
    if connections[instance] then
    connections[instance]:Disconnect()
    end
    end)

    • @chris_beingstupid
      @chris_beingstupid ปีที่แล้ว +3

      because it needs to be "local connections = {}"

    • @MeatMake
      @MeatMake ปีที่แล้ว

      spitting actual facts though @@chris_beingstupid

  • @hungryhungryhummer
    @hungryhungryhummer 3 ปีที่แล้ว +1

    Love you dad

    • @BRicey
      @BRicey  3 ปีที่แล้ว +2

      U too son

  • @baseplate_462
    @baseplate_462 3 ปีที่แล้ว +3

    Wow. My method would be to have a single script in all like objects that would just clone The script they were going to use from server storage then delete the script that setup the clone.
    This way when i wanted to update all those models, i just change one code.

    • @BRicey
      @BRicey  3 ปีที่แล้ว

      That's one way of doing it. It's not wrong, but I feel like collection service would be easier.

  • @susmanrules
    @susmanrules 3 ปีที่แล้ว

    by that i mean you can select multiple units by holding left click selction and then once they are selected they will pathfind to the cursors location

    • @templed2021
      @templed2021 3 ปีที่แล้ว

      very specific...

  • @MinhNgo-wj1xq
    @MinhNgo-wj1xq 6 หลายเดือนก่อน

    I tried this but the problem was like one of the parts were transported from the replicatedStorage into the workspace but still, it does not work.

  • @_quite.essentiallyjay
    @_quite.essentiallyjay 2 ปีที่แล้ว

    I was wondering why my game's servers were so slow

  • @3tutorialdelmietitor348
    @3tutorialdelmietitor348 3 ปีที่แล้ว +1

    brother, from the videos I see you have a lot of experience with roblox studio, if I may ask how long have you been using roblox studio?
    however you are great!
    and never give up with roblox studio

  • @MegaSpaghett
    @MegaSpaghett 3 ปีที่แล้ว

    Smart, I just put what in a folder and run a loop getting folder children. Although tagging is better

    • @BRicey
      @BRicey  3 ปีที่แล้ว

      I mean that works too

  • @templed2021
    @templed2021 3 ปีที่แล้ว +1

    Could you make a tutorial on how to do dropdown menus i rlly need it thx

  • @susmanrules
    @susmanrules 3 ปีที่แล้ว +1

    so ive been watching stuff and i cant find what i need can you do a tutorial how to make warcraft 3 type units and selection

  • @stephen5070
    @stephen5070 5 หลายเดือนก่อน

    Whenever I Tag an instance inside the player GUI, for whatever reason it doubles the index length of the returned #Array.
    Can anybody explain why this is happening to me? I tried using differently named Tags and I get the same results.

  • @FINDROBLOX
    @FINDROBLOX 8 หลายเดือนก่อน

    I love after the years of development and watching tutorials everyone says dot like game.players everyone says dot

  • @siddhapandeypanigrahi353
    @siddhapandeypanigrahi353 3 ปีที่แล้ว

    Before watching this I used to put 1 part in server storage with the kill script n then copy it into the workspace during runtime but tagging is better lol 😂

  • @damirandos
    @damirandos 2 ปีที่แล้ว

    How to make "SoldierFriend" team tag?

  • @mice9644
    @mice9644 2 ปีที่แล้ว +1

    Or just use Modules

  • @OcnarfPro
    @OcnarfPro 3 ปีที่แล้ว

    B Ricey

  • @krizzIord
    @krizzIord ปีที่แล้ว

    is this possible with models instead with parts?

  • @_quite.essentiallyjay
    @_quite.essentiallyjay 2 ปีที่แล้ว

    I understand how to go about this with functions and script connections, but what about while loops? How would I implement collection service on while loops

  • @nickmick8306
    @nickmick8306 3 ปีที่แล้ว

    is there a possible way to use this detection with custom characters? Ive got tagged models that the player becomes which they stay tagged but when a player touches the tagged player, it doesn't seem to detect it

    • @BRicey
      @BRicey  3 ปีที่แล้ว

      Maybe the touch is the problem, not the tags.

  • @Taliofgaming69
    @Taliofgaming69 ปีที่แล้ว

    The plugin is unavailable tho D:

  • @doodledud9189
    @doodledud9189 ปีที่แล้ว

    Damn I was just making a folder and using for I,v in pairs()

  • @doggosaurs3489
    @doggosaurs3489 3 ปีที่แล้ว

    How to you get all this knowledge from?

  • @Zwifs
    @Zwifs 2 ปีที่แล้ว

    Very good explained but sometimes hard for me due to my industry knowledge. Table? Huh? Your making a connection dictionary. But very good explanations, I can get in to scripting fast now.

    • @BRicey
      @BRicey  2 ปีที่แล้ว

      Yea Luau is kinda whacky when it comes to industry standards... it even uses 1-indexing instead of 0

  • @pynx8861
    @pynx8861 2 ปีที่แล้ว

    How would you add a local variable which is different for every mine ? I tried using this to add a lot fading platforms that disapear for 10 seconds when I touch them, but I wasn't able to use a local boolean to say if it is already touched. I had to use and Attribute on each platform and update it in the function

  • @priyotrilaksono5722
    @priyotrilaksono5722 ปีที่แล้ว

    on line 18 connection has a blue line local CollectionService = game:GetService("CollectionService")
    local connections = {}
    local function makeLandmine(part)
    part.Touched:Connect(function(hit)
    local character = hit:FindFirstAncestorWhichIsA("Model")
    if character then
    local humanoid = character:FindFirstChild("Humanoid")
    if humanoid then
    local explosion = Instance.new("Explosion")
    explosion.Position = part.Position
    explosion.Parent = workspace
    part:Destroy()
    end
    end
    end)
    connections[part] = connection -- here
    end
    for _, landmine in pairs(CollectionService:GetTagged("Landmine")) do
    makeLandmine(landmine)
    end
    CollectionService:GetInstanceAddedSignal("Landmine"):Connect(function(instance)
    makeLandmine(instance)
    end)
    CollectionService:GetInstanceRemovedSignal("Landmine"):Connect(function(instance)
    if connections[Instance] then
    connections[Instance]:Disconnect()
    end
    end)

    • @priyotrilaksono5722
      @priyotrilaksono5722 ปีที่แล้ว

      and this too

    • @priyotrilaksono5722
      @priyotrilaksono5722 ปีที่แล้ว

      local CollectionService = game:GetService("CollectionService")
      local test = workspace.Test --here
      wait(5)
      CollectionService:AddTag(test, "Landmine")
      wait(5)
      CollectionService:RemoveTag(test, "Landmine")

    • @priyotrilaksono5722
      @priyotrilaksono5722 ปีที่แล้ว

      I cant test the game

  • @libriumdev
    @libriumdev 3 ปีที่แล้ว

    Couldn’t you use tables to accomplish this? What makes this a better method?

    • @ritsu9837
      @ritsu9837 3 ปีที่แล้ว

      Yes I think using tables woul be easier but I would like to know what makes it a better method

    • @BRicey
      @BRicey  3 ปีที่แล้ว +2

      You are using tables, collection service gives u a table of all of the things tagged.

  • @aridam3563
    @aridam3563 2 ปีที่แล้ว

    Idk if my computer's just broken or smth but it doesn't let me tag the part, when i use the tag thingy this box comes up next to the words and doesn't let me properly do it it'd be real helpful if you could explain what's wrong cause I just wanna make a good game n publish it:(

    • @BRicey
      @BRicey  2 ปีที่แล้ว

      I think since the video has been released, the tag editor was updated, and now you have to click that box, its a check box, when its checked it means a part is tagged.

  • @calixisgreat
    @calixisgreat ปีที่แล้ว

    Not working

  • @Pratixx
    @Pratixx 3 ปีที่แล้ว

    tagging isnt required. you can just loop through the entire game and add whatever you need to if it exists:
    ----------
    for _, v in pairs(game:GetDescendants()) do

    -----

    local function Main(InstanceItem) -- You can also insert any parameters you'd like.

    -- Do whatever

    end

    -----

    local TargetedItemName = 'Part' -- Name of the item your targeting. Set it to nil if you dont want to search by name.
    local TargetedItemClass = 'Part' -- Part, Script, LocalScript, Sound, FloorWire, etc. Set it to nil if you dont want to search by class.

    -----

    if TargetedItemName == nil and v.ClassName == TargetedItemClass then

    Main(v)

    elseif TargetedItemClass == nil and v.Name == TargetedItemName then

    Main(v)

    elseif v.Name == TargetedItemName and v.ClassName == TargetedItemClass then

    Main(v)

    end

    -----

    end

    • @quinnsaunders6415
      @quinnsaunders6415 3 ปีที่แล้ว +2

      Looping through game descendants requires a lot of computing power, especially players with not-so-optimal computers (or phones) which is the majority of the ROBLOX platform.
      Also, tagging allows you to target groups of parts with different names and is a lot easier to read anyway. While it's not needed, it's much more readable and flexible.

    • @Gvistic
      @Gvistic 3 ปีที่แล้ว +2

      Plus you don't get the cool dynamic collection service functions such as "GetInstanceAddedSignal" or "GetInstanceRemovedSignal"

  • @L3G5ND
    @L3G5ND 3 ปีที่แล้ว

    Thanks

  • @mong1849
    @mong1849 3 ปีที่แล้ว

    Paul Joseph Watson

  • @jimmytarn1076
    @jimmytarn1076 3 ปีที่แล้ว

    first

  • @miffclick3358
    @miffclick3358 2 ปีที่แล้ว

    couldnt u just do this with a modulescript

  • @goofymanmike623
    @goofymanmike623 3 ปีที่แล้ว

    Can you make a tutorial on how to make a rocket (body velocity )