Code with error:

local b = workspace.thing.Part.SurfaceGui:GetDescendants()
        if #b < 8 then

Full code:

local id = 5780951564
local tp = game:GetService("TeleportService")
local db = true
script.Parent.Touched:Connect(function(char)
	if db == true then
		db = false
		char = char.Parent
		local b = workspace.thing.Part.SurfaceGui:GetDescendants()
		if (#b) < 8 then
			if not workspace.thing.Part.SurfaceGui:FindFirstChild(char.Name) then
				local a = workspace.thing.Part.SurfaceGui.TextLabel:Clone()
				a.Parent = workspace.thing.Part.SurfaceGui
				a.Text = char.Name
				a.Name = char.Name
				db = true
			end
		elseif #b == 8 then
			for _, v in ipairs(game.Players:GetPlayers()) do
				if table.find(b, v) then
					tp:Teleport(id, v)
					db = true
				end
			end
		elseif #b == nil then
			warn("nil!")
			db = true
		end
	end
end)
local db2 = true
script.Parent.TouchEnded:Connect(function(char2)
	if db2 == true then
		db2 = false
		char2 = char2.Parent
		workspace.thing.Part.SurfaceGui:WaitForChild(char2.Name):Destroy()
		db2 = true
	end
end)

Why am I getting the error Attempt to compare number and boolean? All help is appreciated!

2 comments

0

the fact that this is already solved makes me mad because i want to know how it was a boolean

0

^ I just uploaded my game to roblox wrong, it was erroring with old code.