Hellur, so I have a simple for loop inside of a local function that should run but does not. Either something is really wrong or I just broke it some way. The output does not give any error, the function just does not run past line 39.

Server script: Please ignore the prints. I know there is like 3 types I used.

local Scan = {'G17'}
local Status = script.Parent.Parent.Parent.Parent.Status
local Label = script:WaitForChild("Example")
local Scanner = script.Parent.Parent.Parent.Parent:GetChildren()
local Detector = script.Parent.Parent.Parent.Parent.Regoin
function CallRegion(Area)
	print(Area)
	local upVal1 = Area.Position - (Area.Size/2)
	local upVal2 = Area.Position + (Area.Size/2)
	print(upVal1, upVal2)
	return Region3.new(upVal1, upVal2)
end
local function LocatePlayers(Area)
	print 'Called'
	for _,v in pairs(Status.Text.Frame:GetChildren()) do
		if v.Name == "Player" then
			game:GetService("Debris"):AddItem(v, .1)
		end
	end
	print'20'
	local Region = CallRegion(Area)
	local GetParts = workspace:FindPartsInRegion3(Region, nil, math.huge)
	local Players = {}
	print'24'
	for _,v in pairs(GetParts) do
		local Player = game.Players:GetPlayerFromCharacter(v.Parent)
		if Player then
			for i,_ in pairs(Players) do
				if not Players[i].Name == Player.Name then
					table.insert(Players, Player)
					print 'Ye boiiiiiiiszzxxx.'
					for q,n in pairs(Players) do
						print(Players[q])
					end
				end
			end
		end
	end
	print'37'
	for i,_ in pairs(Players) do
		print'Checking...'
		for _,tools in pairs(Scan) do
			if Players[i].Backpack:FindFirstChild(tools) then
				print 'Oof. I got that unarmed thing wrong.'
				--[[local Clone = Label:Clone()
				local Name = string.upper(v.Name)
				Clone.Text = Name.." - [ARMED]"
				Clone.TextColor = Color3.fromRGB(250, 36, 21)
				Clone.Name = "Player"
				Clone.Parent = Status.Text.Frame]]
			else
				--[[local Clone = Label:Clone()
				local Name = string.upper(v.Name)
				Clone.Text = Name.." - [UNARMED]"
				Clone.Name = "Player"
				Clone.Parent = Status.Text.Frame]]
				print 'Someone is armed!'
			end
		end
	end
	print'61'
	return Players
end

script.Parent.MouseClick:Connect(function(Player)
	if Player.TeamColor ~= BrickColor.new("Dark stone grey") then
		return
	else
		LocatePlayers(Detector)
	end
end)

8 comments

0

61 never prints? If the pairs on line 40 never runs its likely because the Players table is empty, try printing it.

0

61 does print. The table cannot be empty as if you had looked at the script, it does print everything in the table on line 32. So there are objects in the table but this doesn't function the way it should.

0

It does print checking... tho. So they're not empty.

2

Maybe dont give the person attitude whos trying to help you out. Best of luck.

0

Exactly, Dinoz. But anyways why does it say "Tools in pairs.." but there's no 'Tools' Variable?

0

There is no variable requirement for a loop except what you're looping through. For example: for i,v in pairs() used "i" and "v" without a set variable.

0

Dinzo, sorry if it seemed that way. That is not how I intended it to read.

2

He wasn't giving an attitude, he was stating his opinion.