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

Why won't the block kill me when I touch it? [closed]

Asked by 5 years ago

Part = script.Parent

Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end)

Closed as Non-Descriptive by hiimgoodpack and BlackOrange3343

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
RAFA1608 543 Moderation Voter
5 years ago
Edited 5 years ago

It worked normal for me. Perhaps its that its parented to something that isnt a part? anyways,

Part = script.Parent
Part.Touched:Connect(function(hit)
    local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
    if humanoid then
        humanoid.Health = 0
    end
end)

Try this. About your script, it likely wont work because of some scripts that come in free models that change the humanoid's name, and those stuff. Try not using free models. i guess

0
I wasn't using free models but the things that I did differently were: 1. I did not put "whichIsA in my findfirstchild command. 2. I used mine in a local script. Do you think I did something wrong FireCoolflame 21 — 5y
0
You can't use a local script for this if im not wrong. XviperIink 428 — 5y
0
Localscripts only run if they are a descendant of a player and/or a character or the replicated first service RAFA1608 543 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Not sure if this could cause it for setting health to 0 not registering or something, however you could try this.

Part = script.Parent
Part.Touched:Connect(function(hit)
    local char = hit.Parent
    char:BreakJoints()
end)