Attempt to index boolean with 'HasZombie'

So, It seems that Roblox messed up this code, but idk how to really fix it.

In the “Infinite Mining Game Kit” By berezaa, Every time a cave generates, it seems to break and shows this error.

c975f727c1a2df05b7425266d232fee2

I tried to rewrite the code a bit, but it doesn’t seem to work, anyone know the issue?

if Override ~= "Branch" and Override ~= "BranchProtect" then

	if CaveInfo == nil then
		CaveInfo = {}
		CaveInfo.Origin = Vector3.new(x,y,z)
		-- Should this cave contain a zombie?
		local Chance = Rand:NextInteger(1,8)
		CaveInfo.HasZombie = false
		CaveInfo.FirstZombie = false
		if Chance <= 2 then
			CaveInfo.HasZombie = true
			CaveInfo.ZombiePos = nil
		end

	end				

	local Origin = PositionKey(x,y,z)
	GCounts[Origin] = 0
	--coroutine.resume(coroutine.create((function()
	for i,Vec in pairs(VectorsGen) do
		local NewPos = CompactPos + Vec
		if UsedPositions[PositionKey(NewPos.x,NewPos.y,NewPos.z)] == nil then
			GCounts[Origin] = GCounts[Origin] + 1
			GenerateOre(NewPos.x,NewPos.y,NewPos.z,"Branch",Origin,nil,nil,CaveInfo)
		end
	end
	--end)))
else
	local Protection = false
	local Origin = PresetOre




	--local SpecialCave

	-- Ladder brick support				

	if (CaveInfo.HasZombie and CaveInfo.ZombiePos == nil) then
		--generate cave
	end
end

Which line in the sample code you have provided contains the error?

2 Likes

Nvm I managed to fix it myself.