So in a script that I've had for a few years, its worked fine until a recent update that made some things break. For instence this bit I cut out from the script. Engine isn't being detected but I know its present, and the CheckExists function does work because its being used throughout the script.

What could be causing the issue?

local BFM = {}

function BFM:CheckExists(object,parent,giveError,returnIfFalse) --Check if Object exists
	if parent:FindFirstChild(object) ~= nil then return parent[object]
	else
		if giveError == true then self:msg("Cannot find specified object, "..object..", in parent, "..parent.Name..".","Error",true,true,false,false,false,false) end
		return returnIfFalse
	end
end


local function adminCMD(player,cmd)
	if BFM:CheckExists("Engine",player.PlayerGui,true,false) ~= false then  --Engine isnt being detected.
	else error = error + 1 end
end

2 comments

0

Try :WaitForChild() and see if that works. If it says infinite yield then maybe you indexed it incorrectly, another script may have affected the object, or the object left the workspace if it fell below the baseplate.

0

I have tried putting local Engine = player.PlayerGui:WaitForChild("Engine") but it still happens. Unless you mean put the :WaitForChild() somewhere else?