that looks very good i think its more efficient and takes less memory but
you are checking for HumRootPart There are more parts to check for like Legs/Arms/Head
if alot of things are touching the player it may fire the event alot
but yeah i think that is good
amnot sure of that you can wait until someone else respond
Usually the HRP is also touched, but yeah I’ll make sure to use a for loop on all the character’s baseparts. It would still be more effective in the long run though probably.
It depends on the game aswell, maybe some games will only have a few baseparts that need to be touched.
But obbies should probably use this sort of code all the time
yeah am making an obby and i think i will use that method but i will wait for someone to respond amnot sure if it has any cons because i havnot seen anyone using it in a game before
It’s not necessarily bad but there aren’t many pros over just using collection service. First of all, there are different kind of kill bricks and generally you should handle killing / damaging the player on the server side.
A client could simply delete that function or hook it, defeating the whole purpose. Then again, normal kill bricks aren’t invincible to this kind of thing.
Lastly, you’d be using more memory client side- and you have a misunderstanding about CollectionService. No, kill bricks will not ruin your game and cause memory Armageddon. Though connecting a hit every time the player touches something and checking the name will cause issues.
So please, just use collection service. It’s better and less of a hassle.
Connections are very cheap on memory. As a test, I connected touched signals on 1,089 parts and the took up ~0.07mb of memory initially with a simple damage logic.
You’re assuming your method would take a substantially less amount of memory. You, in your bout to find a better method than collection service, end up having to loop through the player and create 15 rbxscriptsignals that are all handled on the client.
Not to mention, you’d get the function fired every time it touches something. Sure, you’re obviously going to have an if statement blocking it from doing anything, but in my opinion it seems like a not-so-great way to deal with damages. Like I said, collection service does NOT use that much memory.