HitboxClass | v1.1B | A Powerful OOP-based Hitbox Module

and fix your module before you decide to post it for everyone to use

1 Like

If you read the documentation, itā€™ll say it takes a type ā€œ{Model}?ā€ which means it can take a table of models or nil. So pass in a table of models for the blacklist or nothing.

hitChars, as the name would imply, is a table containing all the characters it has hit. Youā€™ll need to loop through them.

Sorry for the late reply! Iā€™ve been busy recently. I found the bug and Iā€™ll be pushing the fix soon once I get home. Along with something else Iā€™ve been working on for the module.

not a nice thing to say considering this module is being released for free and is getting frequent support, heā€™s not obligated.

1 Like

Updated HitboxClass to v1.1B

  • Fixed the bug where blacklists would not work in object mode.

This update can be dropped in with no changes in functionality.

Next release should be adding either :Once() or hitbox modification. Either or once I finish and stress test those features some more once I get the time. Hitbox modification is sort of difficult since thereā€™s a fair number of edge-cases that need to be handled if I want it to be very flexible, or I might just decide to keep it more strict.

2 Likes

Any idea why this is happening?

Is it not getting fired to the server at all? The hitbox is fairly fast, and the hitbox might be stopping/getting destroyed before the client can respond, since it needs to make a 2 way trip from the server to the client and back. Try making the hitbox last a little longer and see if it becomes more reliable.

Okay my bad, I was just wondering abt his whereabouts

Yo, This module is awesome!! This is quite literally the best hitbox module youā€™ll find on roblox. Good Job!!!

I feel like the documentation about setting the module up should be more detailed.
Currently, I am still figuring out how to set it up. At first, I tried setting it up on the client since I wanted to first check for hits on the client for responsiveness, then recheck the hits with another hitbox on the server, but then it seems that you canā€™t run it on the client.

I am also creating a new Hitclass object every time I want to detect hits but then it seems like you are supposed to create it once and reuse it.

What do you mean by client hitboxes? Hitboxes ran on the client? Or hitboxes that are attached to player characters.

I may be stupid, but I am just really trying to figure out how to set this up through trial and error.

edit: Just read through the replies above me and it seems like I am not the only one struggling with the set up, with people calling new everytime they need to check for hits then destroy it afterwards, others having no clue how client setup works, creating connections incorrectly.

And I bet that 99% of users here are getting memory leaks from not destroying the hitboxes correctly because it isnā€™t detailed how cleanup is handled.

1 Like

What are the default settings? Is everything set to false, nil and 0 by default? Or are some set to true?

I feel like the documentation about setting the module up should be more detailed.
Currently, I am still figuring out how to set it up. At first, I tried setting it up on the client since I wanted to first check for hits on the client for responsiveness, then recheck the hits with another hitbox on the server, but then it seems that you canā€™t run it on the client.

I feel like the documentation is pretty clear on that aspect. You can run the module on the client, and can even create hitboxes within the client that donā€™t have a server-sided counterpart. However, the module has to be required on the server before any client-sided hitboxes can be made. You do not need to make any hitboxes, just require the module. The module on the client will wait for the remote event created by the server once itā€™s required on there. Everything needed to set up the module is in this section. The alive folder is generally where you place all the things that can be hit in your game. The projectiles folder is where you place all your objects that you use for VFX and such so that hitboxes donā€™t interfere with raycasts and such, as you usually have that folder in a blacklist.

When a hitbox is made on the client and it detects something, the module will attempt to fire to the server with the results, which the server will not respond to since thereā€™s no server-sided hitbox that the client-sided one is tied to. Itā€™ll still fire the HitSomeone and HitObject signals as normal.

I am also creating a new Hitclass object every time I want to detect hits but then it seems like you are supposed to create it once and reuse it.

You can do it like that, or you can have hitboxes made when the move is first used, and then reuse those later on. I recommend the latter to avoid the initial two-way trip that needs to happen in order to make a connection with the client, which also yields your script for the time it takes for the client to respond or 1.5 seconds at the max.

What do you mean by client hitboxes? Hitboxes ran on the client? Or hitboxes that are attached to player characters.

When a hitbox is made on the server with the UseClient parameter filled, the module attempts a connection with the client to make a corresponding hitbox. When the client makes the hitbox, it responds back to the server and the server will continue what it was doing.

Client-sided hitboxes are ran by the client and then whenever the hitbox detects something, it filters through the results and fires to the server what it found. The server then does some basic checks to ensure only the appropriate types are fired through the signals, {Model} for HitSomeone and {BasePart} for HitObject. Hitboxes on the client tend to be much more responsive, like you said, since the client has much more resources available to perform calculations as well as feeling more responsive to the player themselves since theyā€™re running their own simulation of the game.

And I bet that 99% of users here are getting memory leaks from not destroying the hitboxes correctly because it isnā€™t detailed how cleanup is handled.

The hitbox will cleanup itself through the Destroy method. As long as that method is called and there are no other references to the hitbox (i.e. outside hitbox storage outside of the built-in hitbox cache), the GC will take care of the rest. If there are memory leaks happening, unless thereā€™s something within the module not being cleaned up (which if there is, absolutely let me know, Iā€™ll fix it ASAP), it is due to a mistake on the developer.

What are the default settings? Is everything set to false, nil and 0 by default? Or are some set to true?

Most defaults are listed inside the documentation for each parameter. Such as InitialPosition. If there is no default mentioned, then it is set to nil. Anything that is required will be listed as such, either by having (REQUIRED) next to it, or by not having a ā€œ?ā€ after the type, which means it can be nil. For example, InitialPosition is listed to be ā€œInitialPosition : CFrame?ā€, which means it takes either a CFrame or nil.

If you have any more questions, let me know!

1 Like

Thank you. This is clearer and explains things more clearly.

1 Like

I created a HitboxClass on the server with UseClient property.

Is there a way for me to instantly detect hits on the client without having the server tell the client that a hit has been detected?

You can give a specific ID to the hitbox and then fire to that client the ID of the hitbox, you could piggyback off of a vfx remote if you want. You can then use the GetHitboxCache method to search through the cache and grab the hitbox with that ID you sent. You can then connect to the signals of the hitbox and have vfx and stuff show up when the client detects hits.

1 Like

Would it be more optimal to create a hitbox on the server that use the client over just creating a hitbox on the client? And in testing does anyone know how smooth these hitboxes are when it comes to fast paced melee combat?

Iā€™m having problems with my script. Players join the game, and they are added to the alive folder, BUT, they arenā€™t registered by the hitboxes. What I mean is dummies that are already inside of the Alive folder can be hit, but the character which first joins then gets parented to the alive folder upon joining doesnā€™t get registered by hitboxes. This is the same with dummies who get parented after the game starts. What is a fix for this?

For some reason my projectile has lag for a split second when I try to shoot them and I donā€™t know how to fix it.

I still need help on the projectile lag