--[[ D fl V Y
This is made purely from scratch. If you say I am a free-model-noob, you are obviously blind and I will pwn you (with this wand, ironically).
This is DavyDeckwalker's magic wand, which is voice activated and comes with the primary spells from the Harry Potter books by
J. K. Rowling. It is easy to use, all you have to do is say the incantation for a spell and you automatically cast that spell.
To make your own spell, follow the included instructions. Recommended for scripters only.
]]

 

local wand = script.Parent
local stick = wand.Handle
local inc = script.Name
local owner, connect



function findNearestTorso(pos, dis)
	local list = game.Workspace:children()
	local torso = nil
	local dist = dis
	local temp = nil
	local human = nil
	local temp2 = nil
	for x = 1, #list do
		temp2 = list[x]
		if (temp2.className == "Model") and (temp2 ~= wand.Parent) then
			temp = temp2:findFirstChild("Torso")
			human = temp2:findFirstChild("Humanoid")
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
				if (temp.Position - pos).magnitude < dist then
					torso = temp
				end
			end
		end
	end
	return torso
end

