Raycast Hitbox 4.01: For all your melee needs!

Hey there. I would like to ask a question.

Recently I have seen a similar but different module. ClientCast - A Client-based, Idiosyncratic Hitbox System! Are there any differences between using these modules? I would love to know which one is better for my use case.

If you want to know I am making a client sided raycast hitbox and then sending whether or not the client hit another player or not.

After doing that I then do some simple Direction and Distance checks to see whether or not the player is in front of the enemy and damage the enemy if it is.

So, how are they different?

Thanks

1 Like

I just tried them both so I’ll give you my opinions.

RaycastHitbox appears to be much more user-friendly because it takes into account many miscellaneous things and lets you skip all of that stuff, focusing on what you really wanna code. For instance, it has built-in humanoid debounce and doesn’t require you to even take a glance at raycastparams if you don’t wanna. The one issue I’ve found with it is quite a dealbreaker imo: it doesn’t seem to register hits all that often.

ClientCast lacks the many intricate features that RaycastHitbox has at its disposal, but it does get the job done. Additionally it can be client-side if you’re brave enough to do some good “sanity-checks” to stop player exploits - though you can also just set to server-side by default, which is cool. Unfortunately, I had to create my own collision debounce system because without it, it dealt damage on humanoids multiple times per attack. However, once I implemented it, it was much more consistent in collision than RaycastHitbox - I never ran into the issues that I had with RaycastHitbox not registering enemies sometimes.

Overall, I think ClientCast requires more setup because it doesn’t have many default properties that RaycastHitbox has… but personally it seems to have more reliable hitboxes so I will probably stick with ClientCast than this.

As a side note, I’m not sure why they act so different in detecting collision because they both probably use the exact same features of raycasting, but ¯\_(ツ)_/¯

1 Like

I seriously doubt the hitboxes are different. Although I guess it’s technically possible I don’t see how it would be.

Hi, just came back from a long break, sorry to hear the module isn’t working quite as well for you. Appreciate you taking the time to outline the differences between raycast modules for others to decide on! Seems like your set on another hitbox solution but if possible, it would be appreciated if I can get a repo file of that sword + any code that contained the inaccurate OnHit so I can see if it’s something I can improve on.

Thanks.

3 Likes

Hiya, owner of ClientCast here.
The reason that ClientCast does not offer any built-in methods is because there is no “one-size-fits-all” solution; I do not provide any custom debounces or filtering in the module directly to allow for the developer to have as much customizability as possible - ClientCast is designed with minimalism & maximum customizability in mind. You can see it stated on the thread, too:

Overall, I believe that this module is more useful for beginner programmers than ClientCast; it offers a lot of built-in features that you mentioned, which also becomes the downfall for more professional programmers.

4 Likes

Absolutely - here’s an in-depth demo place I made for you to look around (uncopylocked ofc).

You can switch between both RaycastHitbox and ClientCast modules to see for yourself what I mean by ClientCast being slightly more reliable in collision.

Also there’s an option to move your player to a specific CFrame that I found to be a bit buggier than others, but but you can move around yourself in any angle you’d like as well.

Also, it’s worth to note that I did personally try switching to PartMode and Bypass (implementing my own humanoid debounce in the process) but I ran into the same problems as it did for Default mode (i.e. OnHit event not firing at all sometimes). The place below is set to Default mode:

https://www.roblox.com/games/7478862830

Lemme know if there’s any issues with this place / if you need any additional explanations!

1 Like

I am having the same difficulty to save time here is a shot of my Explorer panel. I have tried many things to get this to work but no luck. I have found that it ‘appears’ to not be creating the destination Vector3 values for the raycast in the Attachments solver. But that may just be misleading.
image

Hello, I have no experience using raycasts and thats why I decided to use this module, But I have encountered an issue, This video shows the issue ive encountered Weird Raycast Glitch - YouTube
I installed the module just like the website said so but for some reason my raycast does not appear to be positioned on the attachment for some reason, But for some other reason this unequipped tool appears to not have the issue, Theres also nothing on the output related to it, I need help, I have been trying to find a solution to this but I can’t.

Hey, thanks, this was really helpful! Took me a while to dig my teeth here since life things but finally got around to see where the problems are and this place really helped me visualize what the problems were so thank you again.

The fix was really stupid; it was just a one-liner change and I just dun-goofed on it lol. I will upload the fix later today.


@CCTVStudios This can be caused by if you are teleporting the player/weapon on the server-side. The server sees the weapon at a different location than the client. See if the server is looking at a different position.

1 Like

V.4.01 Stable

Credits to @bagwan12345 for solving this issue (let me know if it still has inaccuracy issues when you update!). There was about a 1/8 chance the hitbox will fail to find a target. It should now find and detect all hits correctly. If you were/are experiencing any inaccuracy issues, please update your module to 4.01. This issue affects all versions of RaycastHitbox.

GoodSignal

The module now uses GoodSignal which takes advantage of Roblox’s not-so-new-anymore task library and performance improvements.

New Feature: Signal Types

You can now set if you want to use Single listeners (default RaycastHitbox behaviour) or to Default (default Roblox behaviour). More information can be found below:

local hitbox = RaycastHitbox.new()
hitbox.SignalType = RaycastHitbox.SignalType.Default

RaycastHitbox defaults to Single listener type as it is the easiest for beginners to use this module, however, it promotes bad coding practices.


Where to get this new version??!!

The cool kids club:

The cooler kids club:

13 Likes

Whenever I try and make a hitbox it says

Make sure you are using a period ‘.’ and not a colon ‘:’. If it still happens, please provide code you are using that exhibits this error.

Did you require RaycastHitbox?

Can you show the whole script? It should work if those suggestions are fine. Redownload the module maybe?

Its super duper messy sorry about that

local swipe = script:WaitForChild("swipeAnim")
local RaycastHitbox = game:GetService("ReplicatedStorage"):WaitForChild("RaycastHitboxV4")
local debounce = false
local swipeEvent = script.Parent:WaitForChild("Swipe")
local RS = game:GetService("ReplicatedStorage")
local Handle = script.Parent:WaitForChild("Handle")

swipeEvent.OnServerEvent:Connect(function(player)
if debounce == false then
		debounce = true
		local hum = player.Character:WaitForChild("Humanoid")
		local animator = hum:WaitForChild("Animator")
		local loadedswipeAnim = animator:LoadAnimation(swipe)
		local hitboxPart = Instance.new("Part",player.Character)
		hitboxPart.Size = Vector3.new(0.293, 1.079, 5.616)
		hitboxPart.CFrame = Handle.CFrame
			hitboxPart.Name = "hitboxPart"
			hitboxPart.Transparency = 0.75
			hitboxPart.Anchored = false
		local hitboxWeld = Instance.new("WeldConstraint",hitboxPart)
			hitboxWeld.Part0 = hitboxPart
			hitboxWeld.Part1 = Handle
		local trail = Instance.new("Trail",Handle)
		trail.Attachment0 = Handle:WaitForChild("TrailAtt1")
		trail.Attachment1 = Handle:WaitForChild("TrailAtt2")
		
			loadedswipeAnim:Play()
		local hitdebounce = false
		local raycastedHitbox = RaycastHitbox.new(Handle)
		raycastedHitbox:HitStart(2)
		raycastedHitbox.OnHit:Connect(function(otherPart)
		if Handle and hitboxWeld then
			if otherPart.Parent.Humanoid and hitdebounce == false and not otherPart.Parent.Name == player.Name then
				hitdebounce = true
				local hum = otherPart.Parent.Humanoid
				local damagetoTake= math.random(10,15)
				hum:TakeDamage(damagetoTake)
				local hitNotifier = RS:WaitForChild("DamageNotifier"):Clone()
				hitNotifier.Parent = hum.Parent.HumanoidRootPart
				hitNotifier.StudsOffset = Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
				hitNotifier.TextLabel.Text = damagetoTake
				print(player.Name.." slashed "..hum.Parent.Name)
				hitboxPart:Destroy()
				task.wait(0.5)
				hitNotifier:Destroy()
				end
			end
		end)
		task.wait(2)
		hitboxPart:Destroy()
		trail:Destroy()
		task.wait(1)
		debounce = false
		hitdebounce = false
	end
end)

I’ll try redownloading

Edit: OH I FORGOT THE REQUIRE SORRY

:sweat_smile: :+1: Sounds good, no problem.

1 Like

Wow yeah, it seems to work perfectly now! Thanks for the quick fix + all your continual updates on this module! :heart:

1 Like

Thanks for the help, Apparently you were right, The server wasn’t replicating what the client was doing, This is apparently a studio bug that has been arround since june 15 Animations for parts attached to characters with motor6ds not playing for other players It makes desired angle not replicate and also breaks the whole thing. Hope it gets patched, For now ill try to find a way to work arround this

1 Like

Is there a convenient way to automatically create HitPoint attachments on a part? Better yet, on a player character?