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)
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)