room = script.Parent.Parent.Parent
while wait(0.1) do
if room.Human:FindFirstChildOfClass("Model") then
script.Parent.Humanoid.LeftArm.BrickColor = BrickColor.new("Crimson")
print("Arm")
else
script.Parent.Humanoid.LeftArm.BrickColor = BrickColor.new("Medium stone grey")
print("No arm")
end
end
In this state the script works but after changing this:
if room.Human:FindFirstChildOfClass("Model") then
to this:
if room.Human:FindFirstChildOfClass("Model").Part["Left Arm"] then
it stops working and gives an error [indexing nil value]. How can I make it work? I tried multiple indexing ways but none worked.
I want to index a body part of a humanoid model that has randomly generated name. Script checks if the humanoid has body parts and colours them [red] on a hud if they are present and [grey] if they are gone.

3 comments
Try if room.Human:FindFirstChildOfClass("Model")["Left Arm"] then
Workspace.Room1.ControlPanel.Visor.Script1:8: attempt to index a nil value | still gives an error
That error mean it can't find something you put on line 8 in your script.