How can I change a specific body part when a player takes damage

Hi, I’m trying to make a cartoon like shooter.

And I’m wondering if I can add a decal or change a body part to a union if said body part is hit by a projectile, like adding cartoonish bruises or cuts or making a hole using a union or something.

2 Likes

Try detecting when player part is touched

Here is how you get the part touched (inside serverscriptservice):

local Part = game.Workspace.Part

Part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild(“Humanoid”) then
        print(hit.Name)
        — rest of code here, maybe adding in a texture to the part hit? —
    end
end)

Also, if you want to change it to a union, you can’t do that in game. Hope this helps :slight_smile:

Example:

--Make this script in StarterPlayer > StarterCharacterScripts
local char = script.Parent
local deb = false

for i,v in pairs(char:GetChildren()) do
	if v:IsA("BasePart") then
		v.Touched:Connect(function(hit)
			if hit.Name == "Bullet" and deb == false then
				deb = true
				print(hit.Name) --This is only for test but make it to your code
				wait(.5)
				deb = false			
			end
		end)
	end	
end

Thank you for this it really helps!

Thanks for the help dude, thanks

No problem if it really helped i would appreciate getting pinned as solution

If you want to replace an R15 rig’s limb you can use the following method.
https://developer.roblox.com/en-us/api-reference/function/Humanoid/ReplaceBodyPartR15