FindFirstChild Not Working

You can write your topic however you want, but you need to answer these questions:

  1. *I want to use the FindFirstChild but it used to work it does not seem to work anymore.
  2. Include screenshots / videos if possible!
    Expected ‘:’ not ‘.’ calling member function FindFirstChild
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked on the Developer Hub
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Disk = script.Parent
local Seat = Disk.Seat
local Speed = 50
local Sit = game.Workspace.Sit
Seat.touched:connect(function(hit)
	if hit.Parent.FindFirstChild("Humanoid") then 
		if hit.Parent.Humanoid.sit == true then
			Sit = true
			while Sit == true do 
				wait(.5)
				Disk.Velocity = Disk.CFrame.LookVector*Speed
				if hit.Parent.Humanoid.sit == false then
					Sit = false
			end
			
			end
		end
	end
end)
1 Like

Basically hit.Parent.FindFirstChild("Humanoid") is supposed to be hit.Parent:FindFirstChild("Humanoid"). That’s all.

2 Likes

What is the difference? Between the ones you posted?

The error message you got tells you the difference.

1 Like

One has : between Parent and FindFirstChild and one has ..

1 Like

Expanding on what @BenMactavsin has said, you should take a look at this topic. You use : because under the hood Luau uses self to retrieve the child.
That means you could use it with ., but will have to give the object as the first parameter:

hit.Parent.FindFirstChild(hit.Parent, "Humanoid")

But you should always use : as it’s quicker to type the code!

2 Likes