Index nil with with FindFirstChild?

I have no idea why the obj is nil, when the BillboardGui exists + the part also does exist.
Help is really appreciated! :slight_smile:

Instead of FindFirstChild, try using WaitForChild. This happened because script runs before game loads.

I still have the same issue. :slightly_frowning_face:

Could you try cloning the block inside the function?
–Edit–
Because you are cloning it once and destroying it when touched, then block is becoming nil.

Alright, lemme try that out real quick.

Still getting a nil value, I don’t know what’s causing it either.

Try using WaitForChild insted of FindFirstChild in the block value

I did, didn’t do anything rather than giving the same issue.

Try doing this:

for _,v in pairs(block:GetChildren())
  print(v.Name)
end

It’s likely you’re not referencing it properly tbh - or it actually isn’t a child of the cloned block.

I still do believe it is because of the cloning, can you send your code again?

It has no other baseparts not instances, it’s just a singular basepart, how would looping help?

Are you 100% sure that the path is right?

1 Like

local block
local rs = game.ReplicatedStorage:WaitForChild("RewardParts")
for i,v in pairs(rs:GetChildren)do
if v.Name == "Green" then
block = v.Clone()
block.Parent = workspace
end

I want to see if there are any children in the block. Clearly something is going wrong, either with the initial set up or with the pathway.

Could you also post a screenshot of the setup you have in explorer?

1 Like

101% sure. Its inside a folder under ReplicatedStorage.

btw did, green is child of RewardParts ?

image

Yeah, it is a child of the folder.

Are those the children of the block? If so I don’t see any BillboardGUI.