I need help with area of hitbox


Im beginner scripter and i made a rain of arrows. As for right now its a lil bit not what i want. Heres the picture of hitbox area that i want to be there. Also theres a problem with damage. Since i used magnitude it takes dmg even if ur behind a wall

heres my current script of hitbox.

			if hit.Parent:FindFirstChild("Humanoid") then
				hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
				print(hit)
			end
			for _,e in pairs(workspace:GetDescendants()) do
				if e:FindFirstChild("Humanoid") then
					if (arrow.Position - e.HumanoidRootPart.Position).Magnitude < 8 then
						e:FindFirstChild("Humanoid"):TakeDamage(5)
						
						if e:FindFirstChild("Humanoid").WalkSpeed > 2 then
							local speed = e:FindFirstChild("Humanoid").WalkSpeed
							print("SDKDDMDNDMD")
							e:FindFirstChild("Humanoid").WalkSpeed = 2
							task.delay(1,function()
							
							
							e:FindFirstChild("Humanoid").WalkSpeed = speed
						end)
						end
						
						
						
					end
				else
					stuck.Anchored=true
				end
			end

Maybe do Raycast between arrow.Position and e.HumanoidRootPart.Position when this is true if (arrow.Position - e.HumanoidRootPart.Position).Magnitude < 8?
RaycastParams can be configured to include walls only (that saves some performance I believe).
This way you can get walls between arrows and HumanoidRootPart.

theres a problem. Like to take damage arrow has to hit a person and theres a huge chance that none of them will hit the player so it means theres gonnabe no damage. But i want it to take damage while players are under the rain. like i circled the area (on the posts picture) that i want script take damage if it finds any player there. i want it to work like

if players in area then
while wait(1) do
player.Humanoid:TakeDamage(5)
end

like bruh how r u still struggling with these arrows

Then ignore all arrows (I assume they are just for visualization) and use GetPartBoundsInBox where the box is a dangerous area?

I would just check if the arrowvelocity is like at least higher than 5 or smth, and if it is then damage. That’s if you’re using velocity instances.

Replace magnitude detection with region or raycast logic. Magnitude ignores walls.

this one script is just like if i have a part then when ppl are touching it they get damage. But i want it work like that: Theres a source part from which arrows are spawning. And i want it damage people by where is it looking at


theres no problem with taking damage if arrow hits the player. Just the hitbox of one arrow is too small and bc of that theres a big chance that u can walk under the rain and dont get any damage