Raycast Hitbox 4.01: For all your melee needs!

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?

Not at the moment. I am currently working with another developer on an automated solution that will place attachments on a face automagically. No ETA on this yet since I am currently reviewing the best way to go forward with this while minimizing code bloat.

1 Like

looking forward to that if it comes to be!

You have any functions laying around to create an array of DmgPoints on a part by simply passing in the part and resolution of points desired?

That’s exactly the system that is being implemented. I will need to follow up with the other developer helping me implement it to RaycastHitbox before I do so but it does that with a resolution setting.

Unfortunately, I don’t have a function right now that I can give you :stuck_out_tongue:

1 Like

I remember seeing a reply with a custom function for this exact purpose. I’ll edit when I find it.

Here it is:

1 Like

Bruh :weary:

That is so useful! Thank you! I was trying to do it myself and it took me many more lines :stuck_out_tongue:

Now i wish i can get this to work on a sphere!

1 Like

I dont think this is your problem, but you have way more attachments than you need for that sword.

I already have an attachment in my melee weapon called grip, it grips the weapon somewhere, wouldn’t grip be placed in the hitbox therefore every attachment in the tool is a hitbox?

The module only searches for attachments with a given name. Default is “DmgPoint”. You can change this in the script. The attachment name “Grip” isn’t “DmgPoint” so it won’t be part of the hitbox.

1 Like

My hitboxes are delaying and even sometimes not landing. Do you have any idea why?

Clearly the first hit made contact, but it did nothing. This is a huge recurring problem that messes up the entire combat system. vvv
https://i.gyazo.com/308e6d87d881e98ef3274028338e92ba.mp4

Is this on the server? If it is, this is called latency. I provided more insights here on why it lags:


Also is this on the most recent version of Raycast Hitbox? I’ve recently fixed an accuracy issue in 4.01.

When was 4.01 released? I just began work on this system a few days ago.

Also, wouldn’t having damage on the client make it easily exploitable?

1 Like

Check the main post for 4.01, it has a date on it. Redownload it just in case.

Search this thread on sanity checks. I went over numerous examples with numerous developers about it. It’s not exploitable if you make your checks bullet proof.