Child of a parent not found even though it's there

  1. So, I’m making a script for a food bowl. It has a proximity prompt and if you’re holding a food box along with holding the proximity prompt until it ends. It deletes the food box and food is put into the bowl.

  2. The problem: It says that the food box isn’t there even though you’re holding it. Here’s the script
    image

And here’s the output that comes out

  1. I’ve tried switching FindFirstChild with WaitForChild but that didn’t work either

If anyone could help me or give feedbacks it would really be appreciated

Are you sure that the exact name of the Tool instance is “Gato Snack”?

You can see name of the Tool in image.
image

It might have a space character after the k, need to confirm the strings match before moving onto the next stage of debugging

2 Likes

Not related to the topic, but seeing that there is a variable called “isFull” you probably don’t want it to work if “isFull” is true. So the script should be like this:

local pp = script.Parent.Union.ProximityPrompt
local isFull = false

pp.PromptButtonHoldEnded:Connect(function(player)
 local GatoSnack = player.Character:FindFirstChild("Gato Snack")

 if GatoSnack and isFull == false then
  print("Gato Snack poured!")
  GatoSnack:Destroy()
  pp.Parent.Parent.Food.Transparency = 0
  isFull = true
else
  print("Gato Snack not found!")
 end
end)

Hope there’s no typo.

1 Like

I’ve checked, and the name should be the same. But the tool is a clone from Replicated Storage. Don’t know if that affects anything or not

Rename to Gato Snack again. actually "Gato Snack " and “Gato Snack” is different.

"Gato Snack " and "Gato Snack"
2 Likes

OK its because your buying it in a localscript and then your looking for it in a server script and the server cant see the tool only the client can see the tool

you need to make sure the server gives the tool to the character

image

1 Like

Can you show us GatoSnackBuyScript?

Here it is

You should use RemoteEvent and Fire at client, award tool at server

1 Like

what you need to do is when the player clicks the button you send a remote event to the server and the server will clone the snack and adjust the bingusbux value

1 Like

Alright, the problem is solved now. Thanks a lot for helping guys! :happy1: