How to make a scanning tool

How to make a scanning tool like u shoot out a arrow and I use a magnitude and scan and the player around him will print in tbe output

Could you please explain more specific? Im a bit confused, sorry.

I was trying to make a scan tool that scan enemy like u shoot a arrow and the enemy around the arrow got detect and print them out in the output

Have you tried using a function .Touched on the arrow?

Something like this should run after the arrow has been shooted

local players = game:GetService("Players")

while task.wait() do
	for _, player in pairs(players:GetPlayers()) do
		if player:DistanceFromCharacter(arrow.PrimaryPart) < distance then
			print("Player detected")
		end
	end
end

distance could be the range you want the arrow to scan in this case

https://developer.roblox.com/en-us/api-reference/function/Player/DistanceFromCharacter

Here’s a function which essentially performs the same math you have conducted.

1 Like

thanks for reminding I edited it