Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

(IMPORTANT)How to add damage multipliers for headshots and limbshots?

I'm currently making a FPS game and need your help. In the game It will be using CFrame animations and i'm currently working on the bullet damage and need help on how to do more damage if a limb or a head is detected

Here is my code for hit detection

if hitPart then
local hithumanoid =  hitPart.Parent:FindFirstChild("Humanoid")
if hihumanoid then
hithumanoid:takedamage(30)
else
--CREATES A BULLETHOLE--

Unfortunately i can't seemto figure out how to make this work help is appreciated

Thanks

2 comments

0

btw fyi. you need remote events to make it damage the hithumanoid in server.

0

i know

2 answers

✓ Accepted answer

if you are using raycasting then you just check if the names line up

if hitPart then
	local hithumanoid =  hitPart.Parent:FindFirstChild("Humanoid")
	
	if hithumanoid then
		if hitPart.Name == LeftLowerArm or hitPart.Name == LeftUpperArm or hitPart.Name == RightLowerArm or hitPart.Name == RightUpperArm then
		hithumanoid:TakeDamage(55)
	else
		hithumanoid:takedamage(30)
	end

	if not hithumanoid then
		--CREATES A BULLETHOLE--
	end
end

it will be something like this but if you want diffrent limbs for diffrent damage then just put the check for other limbs, like the legs.

5 comments

0

its not working

0

im sorry when it says or if, just make it or

0

what about headshots aswell

0

this works but what about headshot damage as well

0

for headshots crate a seperate if

First, check the part that the bullet is hitting. Then you can add the following code:

Bullet.Touched:Connect(function(Hit)
if Hit.Name == "Head" then
hithumanoid:takedamage(60)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.