function checkTargets()
	local Point1 = (script.Parent.HumanoidRootPart.CFrame*CFrame.new(range,10,-range)).p
	local Point2 = (script.Parent.HumanoidRootPart.CFrame*CFrame.new(-range,-10,range)).p
	local Region = Region3.new(Point2,Point1)
	local tbl = (game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) 
	for i , h in pairs(tbl) do
		print(h)
		if h.Parent and h.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(h.Parent) then
			local v = game.Players:GetPlayerFromCharacter(h.Parent)
			if v.Character.Torso and v.Character.Humanoid.Health > 0 and (v.Character.Torso.Position-mob.Torso.Position).Magnitude <= range then
				return(v)
			end	
		end
	end
end

Using region 3 to return players in a mob's radius. Most of the time it never works. Please help be understand what is going wrong with this.

3 comments

0

sorry for the tabbing, btw I just copy/pasted the function

0

What's the value of your range variable?

0

its like 50