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

[SOLVED] How do i give the killer a point?

Asked by 2 years ago
Edited by Xapelize 2 years ago

I made a script that is inserted into the head of a player, and if someone touches their head they die. I'm trying to give the killer a point in a leaderboard script if they manage to hit someone with their head. How can I make this work? It's not a tool.

Heres the script;

script.Parent.Touched:connect(function(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("team").Value == 0 then
        hit.Parent.Humanoid.Health = 0
    end
end)
0
What's the script.Parent defined as? NotThatFamouss 605 — 2y
0
My bad, I didn't read the whole thing NotThatFamouss 605 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

i remade the script heres the answer;

script.Parent.Touched:connect(function(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("team").Value == 0 then
        local hum = hit.Parent:FindFirstChild("Humanoid")
        if hum.Parent.canBeKilled.Value == true then
            hum.Parent.canBeKilled.Value = false
            hit.Parent.Humanoid.Health = 0
            local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
            plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
        end
    end
end)
Ad

Answer this question