I’m having a simple (i tihnk) but annoying problem, this is a part of code of a tool:
if Hit.Parent:FindFirstChildWhichIsA("Humanoid").Health <= 0 and Hit.Parent.HumanoidRootPart ~= nil then
Hit.Parent.HumanoidRootPart:Destroy()
end
Well, so what im passing through is that after the HumanoidRootPart
gets destroyed, it warns in the output:
"HumanoidRootPart is not a valid member of model “Workspace.Rig”
pr_mary
(pr_mary)
April 8, 2024, 1:09am
#3
You can use Instance:FindFirstChild(name)
In this case, you can do:
if Hit.Parent:FindFirstChildWhichIsA("Humanoid").Health <= 0 and Hit.Parent:FindFirstChild("HumanoidRootPart") then
Hit.Parent.HumanoidRootPart:Destroy()
end
2 Likes
system
(system)
Closed
April 22, 2024, 1:10am
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.