I made a [gor] gibs system but its doesnt work [for melee]

My startercharacter script

local replicatedStorage = game:GetService("ReplicatedStorage")
local limbDamageEvent = replicatedStorage:WaitForChild("LimbDamage")

-- Health values for limbs
local limbHealth = {
    ["Left Arm"] = 50,
    ["Right Arm"] = 50,
    ["Left Leg"] = 50,
    ["Right Leg"] = 50
}

-- Table to track health of player limbs
local playerLimbHealth = {}

-- Listen to the RemoteEvent
limbDamageEvent.OnServerEvent:Connect(function(player, enemyCharacter, limbName)
    if not playerLimbHealth[enemyCharacter] then
        playerLimbHealth[enemyCharacter] = {
            ["Left Arm"] = 50,
            ["Right Arm"] = 50,
            ["Left Leg"] = 50,
            ["Right Leg"] = 50
        }
    end

    -- Decrease limb health
    playerLimbHealth[enemyCharacter][limbName] = playerLimbHealth[enemyCharacter][limbName] - 10 -- Adjust damage amount here

    -- When health is zero, detach the limb and add gibs
    if playerLimbHealth[enemyCharacter][limbName] <= 0 then
        local limb = enemyCharacter:FindFirstChild(limbName)
        if limb then
            -- Add gibs and destroy the limb
            local gib = replicatedStorage.Gibs:FindFirstChild(limbName .. "Gib"):Clone()
            gib.CFrame = limb.CFrame
            gib.Anchored = true -- Ensure gibs are anchored to the ground
            gib.Parent = workspace -- Add gibs to the workspace

            -- Destroy the limb
            limb:Destroy()

            -- Prevent the limb from being detached again by setting health to zero
            playerLimbHealth[enemyCharacter][limbName] = 0
        end
    end
end)

And my server script

local replicatedStorage = game:GetService("ReplicatedStorage")
local limbDamageEvent = replicatedStorage:WaitForChild("LimbDamage")

-- Health values for limbs
local limbHealth = {
    ["Left Arm"] = 50,
    ["Right Arm"] = 50,
    ["Left Leg"] = 50,
    ["Right Leg"] = 50
}

-- Table to track health of player limbs
local playerLimbHealth = {}

-- Listen to the RemoteEvent
limbDamageEvent.OnServerEvent:Connect(function(player, enemyCharacter, limbName)
    if not playerLimbHealth[enemyCharacter] then
        playerLimbHealth[enemyCharacter] = {
            ["Left Arm"] = 50,
            ["Right Arm"] = 50,
            ["Left Leg"] = 50,
            ["Right Leg"] = 50
        }
    end

    -- Decrease limb health
    playerLimbHealth[enemyCharacter][limbName] = playerLimbHealth[enemyCharacter][limbName] - 10 -- Adjust damage amount here

    -- When health is zero, detach the limb and add gibs
    if playerLimbHealth[enemyCharacter][limbName] <= 0 then
        local limb = enemyCharacter:FindFirstChild(limbName)
        if limb then
            -- Add gibs and destroy the limb
            local gib = replicatedStorage.Gibs:FindFirstChild(limbName .. "Gib"):Clone()
            gib.CFrame = limb.CFrame
            gib.Anchored = true -- Ensure gibs are anchored to the ground
            gib.Parent = workspace -- Add gibs to the workspace

            -- Destroy the limb
            limb:Destroy()

            -- Prevent the limb from being detached again by setting health to zero
            playerLimbHealth[enemyCharacter][limbName] = 0
        end
    end
end)

Ekran görüntüsü 2025-01-26 172552

It’s nice that you have the scripts and an ss of instances, but I’d say if you explain what doesn’t work and what you want to achieve you’ll increase the likelihood of getting help by a fair amount, personally I don’t know which part doesn’t work or how it’s suppost to end up working

My sword’s HitAttachment inside the handle replaces a specific limb of a player with Gibs if it hits that limb. The limb health mechanic when a player gives a damage specific to that limb, and if it reaches a certain amount the limb is replaced with Gibs However I don’t know where I made a mistake and my coding knowledge is a bit weak to solve this

I also belive this under the wrong categorie, because you listed it as a bug. I would apprechiate if you could change it to only scripting help.