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

The kill script is not working and have written it correctly?

Asked by 3 years ago
script.Parent.Touched:Connect(function(Hit)
    if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
        Hit.Parent.Health = 0

    end




    end)


0
Because Hit.Parent would be the Character model of the player which is just a regular model and Health is not a property of the model so do Hit.Parent.Humanoid.Health = 0 that will work. All characters have a humanoid in it which has a lot of properties here are the properties of the humanoid https://developer.roblox.com/en-us/api-reference/class/Humanoid. The developer wiki can teach you a lot. MarkedTomato 810 — 3y

1 answer

Log in to vote
0
Answered by
fq0e 0
3 years ago

try this:

script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
Hit.Parent.Humanoid.Health = 0
end
end)
Ad

Answer this question