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

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

Asked by 4 years ago

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

0
If you wish for the Touched event to only run once, use a :Disconnect() approach. Ziffixture 6913 — 4y
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? Xapelize 2658 — 4y
0
The problem is down in the reply of Jack_Roblox2008's answer. trustydoggy 24 — 4y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

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.

0
The problem is that i don't want it it add more than 1 death in the same brick and others. trustydoggy 24 — 4y
Ad

Answer this question