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

How do i may put a "do nothing" line? or just help me with this

Hey there,hope you are well.I am having a problem.I wanted to make a kill brick that kills and gives a death (Int value) to the player,but i dont want it to repeat with the same brick and with the others,anyways here's the code:

script.Parent.Touched:Connect(function(hit)
	local human = hit.Parent:FindFirstChild("Humanoid")
	if human then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		hit.Parent.Humanoid.Health = 0 
		player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1
	end
end)

****Note:All the kill brick have the same code above

I would be so thankful if you find a way to solve and make this work

3 comments

0

If you wish for the Touched event to only run once, use a :Disconnect() approach.

0

tbh i dont really good at english, do you means for the kill brick that people have touched on it, it's only kills once but they keep kills but no adding death after a people died at that brick, right or not?

0

The problem is down in the reply of Jack_Roblox2008's answer.

1 answer

Do you mean that the kill bricks keeps kills but they don't makes the player's DEATH's intvalue any changes or the brick doesn't kill if someone get killed on the brick?

Comment below so i can get nofication on this, and Ill edit later so Ill post comment on the question so you can get noficated if I edited my answer, and lastly, thanks.

1 comment

0

The problem is that i don't want it it add more than 1 death in the same brick and others.

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