Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --print("zscript by leaquing loaded")
- --search
- local config=require(script.Config)
- local players=workspace.Players
- local playerpos={}
- local thistorso=script.Parent.Torso
- local level=workspace.GameStats.Level
- local thishum=script.Parent.Humanoid
- local remotes=workspace.Remotes
- local parts={}
- local deb
- for i,v in pairs(script.Parent.ZombieNoises:children()) do
- v.Volume=0
- end
- --fix humanoid
- --[[script.Parent.Humanoid.MaxHealth=config.health
- script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth]]
- function search()
- for i,v in pairs(playerpos) do
- table.remove(playerpos,1)
- end
- for i,v in pairs(players:children()) do
- if v and v.Torso then
- table.insert(playerpos,1,v.Torso.Position)
- end
- end
- local lowest=config.sight
- local lowestv3
- for i,v in pairs(playerpos) do
- local dist=math.abs((thistorso.Position-v).magnitude)
- if dist<lowest then
- lowest=dist
- lowestv3=v
- end
- end
- if lowest<=((config.sight+(level.Value-1))) then
- if lowestv3~=nil then
- --print("player spotted at "..tostring(lowestv3))
- else
- --print("no player spotted!")
- end
- end
- return(lowestv3)
- end
- function moveto(point)
- if point~=nil then
- thishum.WalkToPoint=point
- end
- end
- function stopdeb()
- deb=false
- wait(config.dcooldown)
- deb=true
- end
- --setup parts
- for i,v in pairs(script.Parent:children()) do
- if v:IsA("Part") then
- table.insert(parts,1,v)
- end
- end
- deb=true
- for i,v in pairs(parts) do
- v.BrickColor=BrickColor.new("Bright green")
- end
- for i,v in pairs(parts) do
- if v.Name~="Left Arm" or v.Name~="Right Arm" then
- table.remove(parts,i)
- end
- end
- for i,v in pairs(parts) do
- v.Touched:connect(function(hitty)
- --print(hitty.Name.." of "..hitty.Parent.Name.." boinked")
- if deb==true then
- --print("can damage")
- if thishum.Health>0 then
- --print("is alive")
- if hitty.Parent:IsDescendantOf(players) then
- --print("valid player")
- if hitty.Parent:FindFirstChild("Humanoid") then
- --print("passed humanoid check")
- hitty.Parent.Humanoid:TakeDamage((config.damage+((math.floor((level.Value)/5)+1))*5)-5)
- stopdeb()
- end
- end
- end
- end
- end)
- end
- --setup face
- math.randomseed(tick())
- if script.Parent.Head:FindFirstChild("Decal") then
- script.Parent.Head:FindFirstChild("Decal"):Destroy()
- end
- local faced=Instance.new("Decal",script.Parent.Head)
- local face=math.random(1,2)
- if face==1 then
- faced.Texture=config.face1
- else
- faced.Texture=config.face2
- end
- coroutine.wrap(function()
- while wait(30+math.random(-5.00,5.00)) and thishum.Health>0 do
- script.Parent.ZombieNoises:children()[math.random(1,4)]:Play()
- math.randomseed(tick()+math.random(1,tick()))
- end
- end)()
- while wait() and thishum.Health>0 do
- local clo=search()
- moveto(clo)
- wait(config.updatespeed-((level.Value)/15))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement