How to make Realistic Weapon Blocking?

So when a player is blocking with their weapon, I want to do it so that if the person gets hit in the back then they still take damage.

However my issue with the methods I have seen for example Checking the back of a part is that my weapons can go through the body.
So what is then to prevent while they are blocking the script believing that they are hitting the back of the player? And I don’t think I can use something like humanoid lookvectors because realistically that would be too accurate to fully fire.

Information about my weapons:

  • Using Touched

  • Can go through the person’s body

  • Damage isn’t consistent (depends on how long you hit a player and how many limbs)

What I am trying to do:

  • If while the player is blocking someone hits their back (not hits their back through their front) then they take damage.

Any help would be appreciated.

3 Likes

I guess you can try to detect when the weapon hits a shield and then you just simply set the sword’s damage to 0 and instead of making the player invincible.

1 Like

you can use vector3 dot to get if its behind, here is a quick function i wrote.

local function getIfItsBehind(a,b) -- both of the arguments must be a cf, a = killer, b = victim
	local yes = (a.Position - b.Position).Unit
	local look = b.LookVector
	local final = yes:Dot(look)
	if final > .5 then
		return false
	else
		return true
	end
end
3 Likes

Thank you so much, it worked amazingly.

1 Like