Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

attempt to index nil with 'FindFirstChild'?

I was editing a script to be FE so I could use it on VSB in Roblox, but everytime I tested it I would get the error: Attempt to index nil with 'FindFirstChild'. This part of the code is where it would have an error. The error is at line 7.

campos = campos:lerp((o37.CFrame * CFrame.Angles(math.rad(90 - xt),math.rad(0 - yt),math.rad(90 - zt))) * CFrame.new(nvec),0.33)
		camera.CoordinateFrame = campos
		char:FindFirstChild("Humanoid").WalkSpeed = 0
		char:FindFirstChild("Humanoid").JumpPower = 0
	else
		if returnhome == true then
			tCf = (char:FindFirstChild("Head").CFrame + Vector3.new(0,5,0)) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))

2 comments

0

There isn't enough code to fully give an answer, but check to see if the char variable is accessible from that scope. Also, make sure char is assigned.

0

well, that's pretty much all of the code that I could get before it hits 'end'

1 answer

The problem usually lies on the variable because variable cant be accessed example character or player it cant be accessed so code after it will give an error like in this case :FindFirstChild and char is infront of it which means the culprit is char.

My point is that char is the error because you didnt define it.

This discussion is preserved as it was. New answers, comments, and votes are closed.