Organizing your Game with Tags and CollectionService - Roblox Studio

  Рет қаралды 33,066

B Ricey

B Ricey

Күн бұрын

Пікірлер: 86
@wokenpok
@wokenpok 8 ай бұрын
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!
@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!
@SurfsUpSeth
@SurfsUpSeth Жыл бұрын
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 Жыл бұрын
can u show me something about ur class
@ooo8188
@ooo8188 Жыл бұрын
how did you create your classes?
@MrChaoticCrazed
@MrChaoticCrazed 8 ай бұрын
@@ooo8188Object Oriented Programming with Modules
@jonnyramos50
@jonnyramos50 3 жыл бұрын
Keep grinding bro your content is very much appreciated
@Reptle_
@Reptle_ 3 жыл бұрын
Best Roblox Studio youtuber on the platform
@stefotheguy2766
@stefotheguy2766 3 жыл бұрын
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 жыл бұрын
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
@FghHhj-vb5ff
@FghHhj-vb5ff Жыл бұрын
I think ur one of the best scripters out there!
@BRicey
@BRicey Жыл бұрын
Thank you!
@CookieSnackRhythm
@CookieSnackRhythm 3 жыл бұрын
i wasn't ready for "So lets say you are building a landmine" 🤣
@BRicey
@BRicey 3 жыл бұрын
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 жыл бұрын
@@BRicey how did you learn to script?
@BigFloppaEnthusiast
@BigFloppaEnthusiast 8 ай бұрын
I don't comment often but this was really helpful with collectathon systems, I wish learned about tags sooner
@nathanerickson7464
@nathanerickson7464 9 ай бұрын
Man, you need to keep this up, you saved my life today with this vid!
@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!
@adum2198
@adum2198 3 жыл бұрын
Honestly, why do you have so little views and subs when you explain it so well?
@BRicey
@BRicey 3 жыл бұрын
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 жыл бұрын
@@BRicey this is true my dog actually joined in.
@libriumdev
@libriumdev 3 жыл бұрын
@@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.
@karlmarx2704
@karlmarx2704 3 жыл бұрын
You had me at landmine
@3tutorialdelmietitor348
@3tutorialdelmietitor348 3 жыл бұрын
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
@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...
@snowfall_edits
@snowfall_edits 3 жыл бұрын
commiting war crimes with the bois (great tutorial dude)
@EAGamers10
@EAGamers10 2 жыл бұрын
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 Жыл бұрын
because it needs to be "local connections = {}"
@MeatMake
@MeatMake Жыл бұрын
spitting actual facts though @@chris_beingstupid
@baseplate_462
@baseplate_462 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.
@zhanfl8670
@zhanfl8670 3 жыл бұрын
this is very useful, im subbing man
@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
@hungryhungryhummer
@hungryhungryhummer 3 жыл бұрын
Love you dad
@BRicey
@BRicey 3 жыл бұрын
U too son
@FINDROBLOX
@FINDROBLOX 7 ай бұрын
I love after the years of development and watching tutorials everyone says dot like game.players everyone says dot
@Saykator
@Saykator 3 ай бұрын
Thank you, it was clear
@MinhNgo-wj1xq
@MinhNgo-wj1xq 5 ай бұрын
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.
@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 😂
@susmanrules
@susmanrules 3 жыл бұрын
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
@_quite.essentiallyjay
@_quite.essentiallyjay 2 жыл бұрын
I was wondering why my game's servers were so slow
@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.
@templed2021
@templed2021 3 жыл бұрын
Could you make a tutorial on how to do dropdown menus i rlly need it thx
@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
@damirandos
@damirandos 2 жыл бұрын
How to make "SoldierFriend" team tag?
@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
@_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
@_quite.essentiallyjay
@_quite.essentiallyjay 2 жыл бұрын
nevermind coroutines
@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.
@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.
@mice9644
@mice9644 2 жыл бұрын
Or just use Modules
@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
@autisticbluesloth5244
@autisticbluesloth5244 Жыл бұрын
use set attribute
@doodledud9189
@doodledud9189 11 ай бұрын
Damn I was just making a folder and using for I,v in pairs()
@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 жыл бұрын
You are using tables, collection service gives u a table of all of the things tagged.
@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 жыл бұрын
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 2 жыл бұрын
Plus you don't get the cool dynamic collection service functions such as "GetInstanceAddedSignal" or "GetInstanceRemovedSignal"
@doggosaurs3489
@doggosaurs3489 3 жыл бұрын
How to you get all this knowledge from?
@krizzIord
@krizzIord Жыл бұрын
is this possible with models instead with parts?
@OcnarfPro
@OcnarfPro 3 жыл бұрын
B Ricey
@Taliofgaming69
@Taliofgaming69 Жыл бұрын
The plugin is unavailable tho D:
@calixisgreat
@calixisgreat Жыл бұрын
Not working
@mong1849
@mong1849 3 жыл бұрын
Paul Joseph Watson
@L3G5ND
@L3G5ND 3 жыл бұрын
Thanks
@jimmytarn1076
@jimmytarn1076 3 жыл бұрын
first
@templed2021
@templed2021 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 )
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
What is Object Oriented Progamming?
13:27
GnomeCode
Рет қаралды 47 М.
CollectionService! (Tags & Stop Repeating) | Roblox Studio
13:21
Stewiepfing
Рет қаралды 1,5 М.
Roblox Devs, stop misusing :WaitForChild()!
17:13
Crusherfire
Рет қаралды 77 М.
you SUCK at organizing scripts... Let's fix that!
13:12
Crusherfire
Рет қаралды 24 М.
What are Module Scripts? Roblox Scripting Explained
8:04
GnomeCode
Рет қаралды 160 М.
Bye-bye Raycasting! There's a new kid on the block...
15:13
Crusherfire
Рет қаралды 62 М.
Teaching My Noob Friend To Build on Roblox (He's a Pro Now)
23:07
Семейные уловки (Анимация)
10:02
Найс
Рет қаралды 1,1 МЛН