Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

2 comments

0

What's the script.Parent defined as?

0

My bad, I didn't read the whole thing

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.