ClientCast - A Client-based, Idiosyncratic Hitbox System!

.Touched is really innacurate and leads to a lot of problems.

only if you aren’t using it right

What do you mean by that, could you explain how to use it “right”?

https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched

1.11.0 & 1.12.0

  • Added an informative error for when the module is attempted to be required from the client
  • Added a yield for Player.PlayerGui to prevent issues when PlayerGui does not immediately replicate
  • Updated Testing.server.lua to set player Owner
  • Updated testing.project.json to work properly
  • Removed debug warning which was left out
2 Likes

That’s the API, not really sure how that proves your point?


.Touched relies of physics-based collisions which makes it unreliable, and why would you use .Touched when you have better options like WorldRoot:Raycast() and Region3 or OverlayParams? They are much more accurate, give you a lot more information about the hit, and WorldRoot:Raycast() is almost as fast as .Touched (slightly more expensive, but the pros greatly outweigh the cons).

1 Like

.Touched can be laggy and its not always accurate, not the best performant-wise either.

I’m having some issues when it comes to making an NPC that swings a weapon in a loop. Now this issue seems to be pretty minor and I’m not sure if it is something I should ignore or not but every time the NPC sword uses ClientCaster it prints this warning: ▶ No replication connection found - Server - ClientCast:344 though it doesn’t seem to affect anything. It just fills up the console and it might be causing an issue I don’t see. I am not setting an owner for the caster btw. Anybody know what to do about this?

Yeah, it’s a warning that was left there by accident which I removed since last update. Simply updating the module to the latest version should fix this!
This was because I originally only expected people to use ClientCast for Client<–>Server communication, but it’s since been supported for just generic server/NPC hitboxes also :slightly_smiling_face:

Alright thanks. I was confused whether I should’ve been concerned about it or not.

Hi again!

There’s this really weird behavior that I cannot just wrap my head around.

So I made a viewmodel arm system, works great. How I do it is I basically just set the Motor6D’s Part0 of both arms to the viewmodel’s torso and set the CFrame of the viewmodel to the camera’s CFrame. Thus, making the arm move based on where the camera is looking.

Except the weird thing is, the sword works only whenever I am not in first person (basically, when the viewmodel is disabled).

I noticed is that whenever I switch to the server window and go back to the client, it gets fixed? And whenever I reset, the problem is back.

Another weird thing is that the issue gets fixed whenever I calculate the hitbox on the server (instead of setting the caster’s Owner to a player)

The welding process which makes the viewmodel work in the first place is definitely messing everything up, but I’m not sure how I would go with fixing it.

Currently, I have two options: either just set the hitbox calculations to the server or actually fix the glitch.

If you can guide me onto how I can fix this issue I would really appreciate it. Thanks for reading!

zombietestgame.rbxl (139.8 KB)

I’ll be honest, I’ve no idea what’s going on here :sweat_smile:
I’m assuming this is a Roblox-related bug where parts welded to a part do not get updated properly. Besides switching client-server contexts, even selecting one of the DmgPoint attachments while in first-person makes hitboxes work again, so I’m inclined to say this is an issue on Roblox’s end.
You should try uploading a live game and see how it performs there - maybe this is a Studio-specific issue?

1 Like

I tried out another viewmodel (with no fake/smaller arms) and weirdly enough, that worked perfectly fine. I believe that me changing the viewmodel’s collision group also had something to do with it.

In the end, I just scrapped the fake arms and just went with the same setup except I make the real arms transparent.

Thanks for replying!

Is it possible to use this for a tool and replace the .touched event with this? I also see that It doesn’t work without it moving so how can go around that?

So long the tool has DmgPoints, yes.
You can’t make it work without moving - raycasts require a direction with a magnitude greater than 0.

Is there a way to only enable debug on the owner client? I’ve tried some things and couldn’t get anything to work. Can’t seem to find anything stating how to or if it’s even possible to only make it show on the client. Any solutions?

Setting an owner and then calling EnableDebug should work. Is there something not working with this behavior?

When i do this it is visible to everybody server wide. I might be doing it wrong?
What i’m doing is when you equip the weapon for the first time it sets the owner and it separate to starting the cast. Anything wrong with doing it like this?

Could you provide a simple .rbxl place which reproduces this issue with minimal lines of code? That doesn’t sound right, I’ll look into it.

Oops! Sorry, I figured it out. I was doing something wrong.
It was an older version of clientcast that had the problem

1 Like