Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player is supposed to die after they kill an officer, but they dont?

Asked by 6 years ago

I have been working on a game for about 3 weeks now, just doing it in my free time and im literally done. Except for this one big issue, its basically a murder mystery type game to tell you the least. There are an Officer and an Agent they must hunt and kill the Culprit. But when the Officer or Agent kill an innocent there supposed to die but they dont.

Heres the script thats supposed to kill them off but it doesnt seem to be working and it gives me no error so I have no clue why its not working. Its the only bug ive got left and I am really excited to finish this game up.

Heres the script

function newcharacter(bloxxedplayer, character) 
    local humanoid = character:FindFirstChild("Humanoid")
    if  humanoid then
        humanoid.Died:connect(function()
        end)
    end
end

-- Officer and agent no kill good guys
function newcharacter(bloxxedplayer, character)
    local humanoid = character:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.Died:connect(function()

            local tag = humanoid:FindFirstChild("creator")
            if tag and tag.Value and tag.Value.Parent == game.Players then
                if tag.Value ~= culprit and bloxxedplayer ~= culprit then
                    local wrongdoer = tag.Value
                    if wrongdoer.Character and wrongdoer.Character.Parent then
                        local wrongdoerhumanoid = wrongdoer.Character:FindFirstChild("Humanoid")
                        if wrongdoerhumanoid then
                            wrongdoerhumanoid.Health = 0
                        end
                    end
                end
            end 
        end)
    end
end

Hopefully you guys may be able to help me out :) Thank you for your time.

0
Where is culprit defined prior to line 17 being reached? M39a9am3R 3210 — 6y
0
That is just a chunk of the script. Should I have posted the whole thing? Its 250+ lines. But its defined later on in the script. GottaHaveAFunTime 218 — 6y

Answer this question