Ive tried using muchacho hitbox, but it lags behind way to much, so ive decided to use client sided hitboxes. But i dont really know how to do this as performant as possible, i heard gettouching parts uses while loops which would cause lag, im trying to do it performant and without touched event someone pls give ideas
The most performant way to do anything like this is probably gonna be raycasts. This seems like the best option, so is there any reason you’re avoiding it?
avoiding touched events? if so they are crappy from what ive heard
No. I was talking about raycasts. Why have you not considered them?
Well they are very animation dependent and some hitboxes i want to be able to hit farther then they should with just animation, lets say i have a player use a move that punches someone and throws them back far, but if the slightly miss them with there fist they dont get hit, and people who are close by dont get throw back because they werent hit by the rays that were in the fist
You should minimize the amount of query when possible. For example, when you attack, you then use BasePart:GetTouchingParts()
once and loop through those BasePart
s. For your hitbox, you can weld it to the Player
upon spawning and code a predictive and/or lag compensated system and use something like workspace:GetPartBoundsInBox()
instead.
what is that supposed to mean you just said i dont understand that, do you want me to use gettouchingparts or getpartboundsinbox
Depends if you are using a hitbox part. Both work the same way, just the other method doesn’t involve using a part.
will this be performance heavy? im trying to get the best system i can before i fully flesh it out and this is going to be used for a module i want to reduce the amount of memory its taking
Unless you are using it thousands of times in a single/couple frames, then no. A simple attack shouldn’t even need a loop, just one upon attacking. Optimize and lower query rates along the way if you run into issues.
I can recommend using this:
It has the ability to be used on the Client easily with LocalPlayerEntered and exited events, in addition to a bunch of other helpful things like how accurate you’d like the system/detection to be.
Turns out this is not a solution and shouldnt be used as a hitbox as the poster even said
I’ve got a guide for hitboxes here. The thing you want to be most careful about preformance wise is how often you check, and for client-sided hitboxes, you can easily afford a 0.1s interval.