Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- soldier157 = Instance.new("Model")
- soldier157.Parent = game.Workspace
- soldier157.Name = "zombie157"
- LA = Instance.new("Part")
- LA.Parent = soldier157
- LA.Name = "Left Arm"
- LA.Size = Vector3.new(1, 2, 1)
- LA.Transparency = 1
- RA = Instance.new("Part")
- RA.Parent = soldier157
- RA.Name = "Right Arm"
- RA.Size = Vector3.new(1, 2, 1)
- RA.Transparency = 1
- Head = Instance.new("Part")
- Head.Parent = soldier157
- Head.Name = "Head"
- Head.Size = Vector3.new(0.1, 0.1, 0.1)
- Head.Transparency = 1
- grrrr = Instance.new("Sound")
- grrrr.Parent = Head
- grrrr.SoundId = "rbxassetid://300708180"
- grrrr.Volume = 7
- Torso = Instance.new("Part")
- Torso.Parent = soldier157
- Torso.Name = "Torso"
- Torso.Size = Vector3.new(4, 5, 1)
- soldier157.PrimaryPart =Torso
- LL = Instance.new("Part")
- LL.Parent = soldier157
- LL.Name ="Left Leg"
- LL.Size = Vector3.new(1, 2, 1)
- LL.Transparency = 1
- RL = Instance.new("Part")
- RL.Parent = soldier157
- RL.Name = "Right Leg"
- RL.Size = Vector3.new(1, 2, 1)
- RL.Transparency = 1
- humanoid = Instance.new("Humanoid")
- humanoid.Parent = soldier157
- humanoid.WalkSpeed = 17
- humanoid.HipHeight = -2
- snap = Instance.new("Snap")
- snap.Parent = soldier157.Torso
- snap.Part0 = Torso
- snap.Part1 = Head
- LH = Instance.new("Motor")
- LH.Parent = soldier157.Torso
- LH.Part0 = Torso
- LH.Part1 = LL
- LS = Instance.new("Motor")
- LS.Parent = soldier157.Torso
- LS.Part0 = Torso
- LS.Part1 = LA
- RH = Instance.new("Motor")
- RH.Parent = soldier157.Torso
- RH.Part0 = Torso
- RH.Part1 = RL
- RS = Instance.new("Motor")
- RS.Parent = soldier157.Torso
- RS.Part0 = Torso
- RS.Part1 = RA
- skin = Instance.new("SpecialMesh")
- skin.MeshId = "rbxassetid://2711200539"
- skin.TextureId = "rbxassetid://4533685150"
- skin.Parent =soldier157
- skin.Parent = Torso
- healthbar = Instance.new("BillboardGui")
- healthbar.Parent = Head
- healthbar.Size = UDim2.new(10, 0,1.2, 0)
- healthbar.StudsOffsetWorldSpace = Vector3.new(-1, 3.5, 0)
- Namee = Instance.new("Frame")
- Namee.Parent = healthbar
- Namee.BorderColor3 = Color3.new(27,42,53)
- Namee.BackgroundColor3 = Color3.new(255,255,255)
- Namee.Size = UDim2.new(1, 0,0.35, 0)
- Namee.BackgroundTransparency = 1
- NpcName = Instance.new("TextLabel")
- NpcName.Parent = Namee
- NpcName.TextStrokeColor3 = Color3.new(0,0,0)
- NpcName.TextColor3 = Color3.new(0,255,0)
- NpcName.Text = " Zombie"
- NpcName.Size = UDim2.new(0.75, 0,2, 0)
- NpcName.BackgroundTransparency = 1
- NpcName.TextSize = 14
- NpcName.TextStrokeTransparency = 0
- wait()
- script.Parent = soldier157
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 1000 --This Line Right Here
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if (temp2.className == "Model") and (temp2 ~= script.Parent) then
- temp = temp2:findFirstChild("Head")
- human = temp2:findFirstChild("Humanoid")
- Ally = game.Workspace:findFirstChild("zombie157")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (Ally == nil) or (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (human.Parent.Name ~= "zombie157") and (human.Parent.Name ~= "sina157") then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end
- end
- end
- end
- x = math.random(0,17)
- if x == 15 then
- humanoid.Jump = true
- end
- return torso
- end
- function dgm(hit)
- humanoid.Health = humanoid.Health + 0.1
- h = hit.Parent:findFirstChild("Humanoid")
- if not h then
- return
- end
- if not hit.Parent:findFirstChild("Humanoid") then
- humanoid.Health = humanoid.Health + 10
- humanoid.MaxHealth = humanoid.MaxHealth + 3
- end
- if hit.Parent.Name ~= "sina157" and hit.Parent.Name ~= "zombie157" then
- hit.Parent:findFirstChild("Humanoid"):TakeDamage(5)
- end
- end
- Torso.Touched:Connect(dgm)
- Head.Touched:Connect(dgm)
- function jump(j)
- grrrr:Play()
- end
- humanoid.Jumping:Connect(jump)
- while true do
- wait(0.1)
- if Torso == nil or humanoid.Health == 0 then
- script.Parent:Destroy()
- end
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then
- script.Parent.Humanoid:MoveTo(target.Position, target)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement