All good. I’ll add special checks for this to make it easier to debug in the future!
Is there a way to implement a feature to toggle debug for a specific client?
Say there’s a settings menu, I want a ‘Debug’ option that you can toggle on and off.
How do you make it so that the module’s rays are debugged by a specific client?
ClientCast is meant to be barebones so that you can easily implement this sort of functionality yourself. What I do for my game is have a simple if-statement check in the localscript where the raycast is done - you could easily setup a remote event to listen to the server, and then use attributes to tell the localscript when to visualize the raycasts.
How would I go about doing this? I can kind of put together what you’re saying but I wouldn’t know how to do that since I’m not really familiar with the module
Is there any reason why are there two identical RemoteFunctions and RemoteEvents on client?
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?