Roblox Studio - Error Addresses Humanoid Under "Head" Despite Not at All being Addressed as Such

I am currently making a short cutscene sequence. When the Head of a player touches the trigger’s script, the player’s WalkSpeed should be 0. However, the error says that it’s not a valid member of Head, even though I have NEVER addressed it as being part of Head, and only as Head.Parent.
This is my issue:
Screenshot 2025-09-01 190705
The error shown is as followed:
Screenshot 2025-09-01 190729

Please note that I am using a StarterCharacter, which is preset to WalkSpeed = 0, but is set to 16 shortly after joining the game due to an unrelated cutscene. Strangely, if it’s preset at 16 the cutscene works as normal. bodyPart is also used to reassign the humanoid’s Health, and changes the color of some of the player’s limbs. Those work as usual, but not WalkSpeed.
Also, other times when I test, the error doesn’t appear but still has a bug.
What is going on? Please help.

1 Like

You said you’re using a custom StarterCharacter. Maybe the model has another part named ‘Head’?

1 Like

Let me see what I can do. I DO have another part named “Head”, which is a mesh. This is because the StarterCharacter needs to be textured, but strangely the head mesh doesnt apply Materials, so I have a second mesh on the part that makes the head look textured.

Edit: Doesn’t make WalkSpeed = 0. No error, though.

1 Like

I checked the value of the Player’s WalkSpeed throughout each step in the gameplay, up to this cutscene. It works as normal, but the WalkSpeed doesn’t change to 0 when this particular cutscene is triggered. I don’t understand why in particular it’s doing this.

There is no error display, either.

1 Like

Then what you can do (and what i usually do) is name that mesh “FakeHead” or something similar. You can see if that fixes it

1 Like

I already did that; in my last message I had stated that it still didn’t solve the issue.

There are zero errors in the outputs. It’s as if it skips over the “bodyPart.Parent:WaitForChild(“Humanoid”).WalkSpeed = 0” line.

Hi, sorry if this might be a dumb reply, but 3 things:

  1. The “infinite yield possible” warning does not halt the script or stop waiting for the child. It is a warning that it might not be able to find what the script is requesting and could halt the script indefinitely until it is added.
  2. Have you tried something like this:
local function Touched(otherPart: BasePart)
	local character = otherPart.Parent;
	
	if character then
		local head = character:FindFirstChild("Head") :: BasePart?
		
		if head and head:IsA("BasePart") then
			local humanoid = character:FindFirstChildOfClass("Humanoid");
			
			if humanoid then
				print("head touched yeah. setting walkspeed");
                                humanoid.WalkSpeed = 0;
                                print("i setted it");
			else
				print("no humanoid");
			end
		else
			if head then
				print("head is not a basepart");
			else
				print("head does not exist");
			end
		end
	else
		print("character does not exist");
	end
end

to debug it? From experience, sometimes scripts can just completely ignore lines or stop runing altogether without a single warning.
3. If it’s a LocalScript it could (keyword COULD) be a replication issue. Least likely though

That’s all I could really think of

1 Like
local char = bodyPart:FindFirstAncestorOfClass("Model")
if char then
  local humanoid = char:FindFirstChildOfClass("Humanoid")
  if humanoid then
    --do code

Your issue is bodyPart.Parent, use bodyPart:FindFirstAncestorOfClass instead.

Tried this. It still doesn’t work. The callback “part.Touched:Connect(bodyPart)” at the bottom of my script doesn’t work with the code you made.
Gives me a blue line under bodyPart in parenthesis.

How can I apply my existing code to it though? I need it to cause the cutscene to still play and work.

Also when I applied the rest of the script to yours a certain way, it did not give me any errors. However it still did not fix the issue, I could still walk.

you aren’t supposed to, try just putting it into a new script temporarily?

I completely forgot about this post, but my friend was able to figure out the problem. He made the cutscene local and using certain remote events it worked.

1 Like

Nice, sorry for the late reply

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.