hello! im working on a gore game and i got a custom gory torso model, i got a weapon script in which if the head is shot by a bullet, the head gets replaced with a different model of the head, it works because it instantly kills you, but i actually want it to do the same with the torso, but not kill instantly, basically just replace the torso with a different model of the torso, without killing the player/just breaking his character.
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local DamageToDoIfTheHitIsAPlayer = 0
local remoteEvent = ReplicatedStorage:FindFirstChild("M1911")
remoteEvent.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos)
game:GetService("ReplicatedStorage")["M1911 Fire"]:Play()
local bullet = Instance.new("Part")
bullet.Position = gunPos
bullet.Orientation = gunOr
bullet.Transparency = 0
bullet.Name = 'Bullet'
bullet.Parent = game.Workspace
bullet.Size = Vector3.new(.25, .25, .25)
bullet.BrickColor = BrickColor.new('Neon orange')
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = false
local speed = 500
bullet.CFrame = CFrame.new(gunPos, mosPos)
bullet.Velocity = bullet.CFrame.lookVector * speed
bullet.Touched:Connect(function(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid and humanoid.Parent.Name ~= player.Name then
local plr = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if humanoid.Health > 0 then
if otherPart.Name ~= "Head" then
humanoid:TakeDamage(30)
local particleEmitter = ReplicatedStorage.Blood:Clone()
particleEmitter.Parent = otherPart
bullet:Destroy()
particleEmitter:Emit()
wait(1)
particleEmitter:Destroy()
elseif otherPart.Name == "Head" then
humanoid:TakeDamage(100)
local Weld = Instance.new("WeldConstraint")
local head = ReplicatedStorage:FindFirstChild("Head"):Clone()
head.CFrame = otherPart.Parent:FindFirstChild("Head").CFrame
head.Position = otherPart.Parent:FindFirstChild("Head").Position
head.Orientation = otherPart.Parent:FindFirstChild("Head").Orientation
head.Parent = workspace
local sound1 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX1")
local sound2 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX2")
local sound3 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX3")
local sound4 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX4")
local sound5 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX5")
local sound6 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX6")
local sound7 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX7")
local sound8 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX8")
local KILLSounds = {sound1, sound2, sound3, sound4}
local DAMAGESounds = {sound5, sound6, sound7, sound8}
head.Color = otherPart.Color
Weld.Part0 = head
Weld.Part1 = otherPart.Parent:FindFirstChild("Torso")
head:FindFirstChild("Part"):FindFirstChild("ParticleEmitter").Enabled = true
KILLSounds[math.random(1, #KILLSounds)]:Play()
DAMAGESounds[math.random(1, #DAMAGESounds)]:Play()
otherPart.Parent:FindFirstChild("Head"):Destroy()
wait(5)
head:FindFirstChild("Part"):FindFirstChild("ParticleEmitter").Enabled = false
end
if otherPart.Name == "Torso" then
humanoid:TakeDamage(25)
local Weld = Instance.new("WeldConstraint")
local head = ReplicatedStorage:FindFirstChild("Torso"):Clone()
head.CFrame = otherPart.Parent:FindFirstChild("Torso").CFrame
head.Position = otherPart.Parent:FindFirstChild("Torso").Position
head.Orientation = otherPart.Parent:FindFirstChild("Torso").Orientation
head.Parent = workspace
local sound1 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX1")
local sound2 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX2")
local sound3 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX3")
local sound4 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX4")
local sound5 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX5")
local sound6 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX6")
local sound7 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX7")
local sound8 = head:FindFirstChild("KillSFX"):FindFirstChild("SFX8")
local KILLSounds = {sound1, sound2, sound3, sound4}
local DAMAGESounds = {sound5, sound6, sound7, sound8}
head.Color = otherPart.Color
Weld.Part0 = head
Weld.Part1 = otherPart.Parent:FindFirstChild("Torso")
head:FindFirstChild("Part"):FindFirstChild("ParticleEmitter").Enabled = true
KILLSounds[math.random(1, #KILLSounds)]:Play()
DAMAGESounds[math.random(1, #DAMAGESounds)]:Play()
otherPart.Parent:FindFirstChild("Torso"):Destroy()
end
end
end
end)
end)