sp=script.Parent lastattack=0 nextrandom=0 nextsound=0 nextjump=0 chasing=false variance=4 damage=15 attackrange=4.5 sightrange=999 runspeed=17 wonderspeed=10 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(I,J,z)local G,R=game.Workspace:FindPartOnRay(Ray.new(I+J*.01,J*z),script.Parent)if G~=nil and R then if G.Parent==script.Parent and G.Transparency>=.8 or G.Name=="\072\097\110\100\108\101"or string.sub(G.Name,1,6)=="\069\102\102\101\099\116"or G.Parent:IsA("\072\097\116")or G.Parent:IsA("\084\111\111\108")or G.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and(G.Parent:FindFirstChild("\084\069\065\077")and(G.Parent:FindFirstChild("\084\069\065\077")).Value==script.Parent.TEAM.Value)or not G.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and G.CanCollide==false then local G=z-(R-I).magnitude return raycast(R,J,G)end end return G,R end function waitForChild(I,J)local z=I:findFirstChild(J)if z then return z end while true do z=I.ChildAdded:wait()if z.Name==J then return z end end end



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

variance=4

damage=15
attackrange=4.5
sightrange=999--60
runspeed=17
wonderspeed=10
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
