Attempt to index nil with..?

Attempt to index nil with BillboardGui even tho it’s there.

wait(2)

local EnterPartRemote = (game:GetService("ReplicatedStorage").EnterPart)
local FakeTorso = (game.Workspace.R6:FindFirstChild("FakeTorso"))
local BillboardGui = (FakeTorso.BillboardGui)

EnterPartRemote.OnClientEvent:Connect(function(PartType, EnterOrLeft)
	if PartType == ("R6DummyPart") then
		if EnterOrLeft == ("Enter") then
			-- When Player Is In
			print("Entered.")
			BillboardGui.Enabled = (true)
		elseif EnterOrLeft == ("Left") then
			print("Left.")
			BillboardGui.Enabled = (false)
		end
	else
		error("Unknown.")
	end
end)

image

The only plausible reason is that during defining FakeTorso, there’s an error. You could try adding WaitForChilds and FindFirstChilds, but your problem might still persist.

I tried, it said attempt to index nil with FindFirstChild.

I also tried simply just doing FakeTorso.BillboardGui, but it says it doesn’t exist although it’s there and it’s always been there and it always will be there.

Maybe game.Workspace:WaitForChild(“R6”):FindFirstChild(“FakeTorso”) could work. Not guaranteed though.

FakeTorso isn’t the issue, it’s the billboardgui. This didn’t fix it.

If the error is “Attempt to index nil with BillboardGui”, FakeTorse is nil (Nothing).

1 Like

How come tho? It’s not destroyed or anything.

Nevermind, I’m not sure why it was destroyed but I fixed it.