sp=script.Parent lastattack=0 nextrandom=0 nextsound=0 nextjump=0 chasing=false variance=4 damage=10 attackrange=4.5 sightrange=999 runspeed=16 wonderspeed=8 healthregen=false colors={"\083\097\110\100 \114\101\100";"\068\117\115\116\121 \082\111\115\101","\077\101\100\105\117\109 \098\108\117\101","\083\097\110\100 \098\108\117\101","\076\097\118\101\110\100\101\114";"\069\097\114\116\104 \103\114\101\101\110","\066\114\111\119\110","\077\101\100\105\117\109 \115\116\111\110\101 \103\114\101\121","\066\114\105\099\107 \121\101\108\108\111\119"}function raycast(E,Z,w)local c,n=game.Workspace:FindPartOnRay(Ray.new(E+Z*.01,Z*w),script.Parent)if c~=nil and n then if c.Parent==script.Parent and c.Transparency>=.8 or c.Name=="\072\097\110\100\108\101"or string.sub(c.Name,1,6)=="\069\102\102\101\099\116"or c.Parent:IsA("\072\097\116")or c.Parent:IsA("\084\111\111\108")or c.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and(c.Parent:FindFirstChild("\084\069\065\077")and(c.Parent:FindFirstChild("\084\069\065\077")).Value==script.Parent.TEAM.Value)or not c.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and c.CanCollide==false then local c=w-(n-E).magnitude return raycast(n,Z,c)end end return c,n end function waitForChild(E,Z)local w=E:findFirstChild(Z)if w then return w end while true do w=E.ChildAdded:wait()if w.Name==Z then return w end end end



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

variance=4

damage=10
attackrange=4.5
sightrange=999--60
runspeed=16
wonderspeed=8
healthregen=false
colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}

function raycast(spos,vec,currentdist)
	local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
	if hit2~=nil and pos2 then
		if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) 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
