Part = script.Parent
Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end)
Part = script.Parent
Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end)
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
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
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
You can't use a local script for this if im not wrong.
Localscripts only run if they are a descendant of a player and/or a character or the replicated first service