Hey Developers this script is for a obby and I am wondering why this doesn’t work? There are no errors.
local KillParts = script.Parent:GetChildren()
for i, part in pairs(KillParts) do
if part:IsA("Part") then
part.Touched:Connect(function(otherpart)
if otherpart.Parent:FindFirstChild("Humanoid") then
otherpart.Parent.Health = 0
end
end)
end
end
change otherpart.Parent.Health to otherpart.Parent.Humanoid.Health since models doesn’t have “Health” property and I’m pretty sure it was just a typing mistake.
still doesn’t work this is what the script is looking like rn, ``` local KillParts = script.Parent:GetChildren()
for i, part in pairs(KillParts) do
if part:IsA("BasePart") then
part.Touched:Connect(function(otherpart)
if otherpart.Parent:FindFirstChild("Humanoid") then
otherpart.Parent.Humanoid.Health = 0
end
end)
end
end
I just realised what has gone wrong with my code sorry for taking ur time but script is in server script service not the child of kill parts tho baseparts thing has saved me thank u!