sp=script.Parent lastattack=0 nextrandom=0 nextsound=0 nextjump=0 chasing=false variance=2 damage=15 attackrange=15 sightrange=200 runspeed=15 wonderspeed=4 healthregen=false function raycast(W,h,U)local B,g=game.Workspace:FindPartOnRay(Ray.new(W+h*.01,h*U),sp)if B~=nil and g then if B.Transparency>=.8 or B.Name=="\072\097\110\100\108\101"or string.sub(B.Name,1,6)=="\069\102\102\101\099\116"then local B=U-(g-W).magnitude return raycast(g,h,B)end end return B,g end function waitForChild(W,h)local U=W:findFirstChild(h)if U then return U end while true do U=W.ChildAdded:wait()if U.Name==h then return U end end end



sp=script.Parent
lastattack=0
nextrandom=0
nextsound=0
nextjump=0
chasing=false

variance=2

damage=15
attackrange=15
sightrange=200
runspeed=15
wonderspeed=4
healthregen=false

function raycast(spos,vec,currentdist)
	local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
	if hit2~=nil and pos2 then
		if hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" then
			local currentdist=currentdist-(pos2-spos).magnitude
			return raycast(pos2,vec,currentdist)
		end
	end
	return hit2,pos2
end

function waitForChild(parent,childName)
	local child=parent:findFirstChild(childName)
	if child then return child end
	while true do
		child=parent.ChildAdded:wait()
		if child.Name==childName then return child end
	end
end
