This should only happen if you call the ClientCast module on the client - ClientCast is only meant to be used from the server; the client-server communication is handled for you.
Thanks for the quick reply, I just realized that I have left localscript with one line requiring the module. Very well made module I am really enjoying playing around with it :).
Is it better and more efficient to use a region3 type of hitbox or your ClientCast hitbox for detection?
im having a problem with the Collided event
ClientCaster.Collided:Connect(function(RaycastResult,Object,ob)
print(ob)
print(RaycastResult)
print(Object)
end)
the first parameter works, it tells me data, but how do i know what part was touched?, i tried making a second parameter it just gives me lua nil
how would i fix?
RaycastResult
is the same as Robloxâs RaycastResult
object:
https://developer.roblox.com/en-us/api-reference/datatype/RaycastResult
So, to answer your question, the object hit would be RaycastResult.Instance
.
Thanks for your response, it works!
Hey, any ideas on how i could implement this for NPCs?
Just create a ClientCaster object without setting the Owner
property, like so:
local Caster = ClientCast.new(HitboxPart, RaycastParams.new())
But i would like the NPCs hit registration to be client based. I tried it on the server and it wasnât accurate. Any ideas?
Uh, why would you handle hitboxes for NPCs on the client? This means a client would be the one to determine if they got hit or not - which can lead to heavy exploitation.
Because server hit registration isnt reliable. My NPC misses its hits sometimes because everything is configured to the server. I could run sanity checks with the server to make sure exploits arent happeningâŚ
Can this be used for static hitboxes? (where the hitbox is more of an AoE)
You would probably be better off handling AoE on the server, as there is not much benefit in doing this on the client.
So the module is capable of detecting the hit without the hitbox moving?
No. This module functions by raycasting from the hitboxâs current position to the hitboxâs last position - if the hitbox didnât move, it would not work because raycasts cannot have 0 magnitude.
Oh, alright. What would be a reliable alternative to doing an AoE attack then? I heard part.Touched was pretty bad so Iâd rather not use that.
You could use the new spatial query API:
Additionally, you can just loop over all players in-game and find which ones are close enough.
Didnât even know this existed. Thanks for the ideas!
Sorry to bug you once more, but how would I go by using this module without a weapon? Could this be implemented into a roblox characterâs arms for fist combat?
Yes, you can use Caster:SetRecursive(true)
to have ClientCast check the whole character model for any hitbox attachments. From there, just put DmgPoint
attachments inside each arm.
local Caster = ClientCast.new(PlayerCharacter, RayParams)
Caster:SetOwner(Player)
Caster:SetRecursive(true)
See Caster:SetRecursive for more info.