Can't find humanoid for the player on a server script

As the title says
image

local Humanoid = player1.Character:WaitForChild("Humanoid")
Humanoid:TakeDamage(5)
  • Make sure the character exists and Humanoid exists.
    instead of just else do:
    elseif player1.Character ~= nil then

I’ve realized the problem. The humanoid isn’t there at all. The region isn’t finding it. Can you help?

while task.wait(1) do
	local regionSearch = workspace:FindPartsInRegion3(region)
	
	for _, v in pairs(regionSearch) do
		
		local hum = v.Parent:FindFirstChild("Humanoid")
		
		if hum then
			local char = game:GetService("Players"):GetPlayerFromCharacter(hum.Parent)
			
			if char ~= nil and hum ~= nil then
				-- do whatever you want with the humanoid
			end
		end
	end
end

I guess you’re trying to damage players in a region judging from the “Humanoid:TakeDamage(5)”, if you are this should work.

I’ve just discovered that region3’s were deprecated. Guess I’ll use something else

Use ZonePlus by ForeverHD. I use it all the time.