Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --com com--
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Decal3 = Instance.new("Decal")
- Script4 = Instance.new("Script")
- Script5 = Instance.new("Script")
- Weld6 = Instance.new("Weld")
- Weld7 = Instance.new("Weld")
- Part8 = Instance.new("Part")
- Motor6D9 = Instance.new("Motor6D")
- Motor6D10 = Instance.new("Motor6D")
- Weld11 = Instance.new("Weld")
- Weld12 = Instance.new("Weld")
- Script13 = Instance.new("Script")
- Part14 = Instance.new("Part")
- Script15 = Instance.new("Script")
- Part16 = Instance.new("Part")
- Weld17 = Instance.new("Weld")
- Script18 = Instance.new("Script")
- Part19 = Instance.new("Part")
- Script20 = Instance.new("Script")
- Part21 = Instance.new("Part")
- Script22 = Instance.new("Script")
- Humanoid23 = Instance.new("Humanoid")
- Hat24 = Instance.new("Hat")
- Part25 = Instance.new("Part")
- SpecialMesh26 = Instance.new("SpecialMesh")
- Script27 = Instance.new("Script")
- Part28 = Instance.new("Part")
- Sound29 = Instance.new("Sound")
- Sound30 = Instance.new("Sound")
- Script31 = Instance.new("Script")
- Script32 = Instance.new("Script")
- Hat33 = Instance.new("Hat")
- Part34 = Instance.new("Part")
- SpecialMesh35 = Instance.new("SpecialMesh")
- Part36 = Instance.new("Part")
- SpecialMesh37 = Instance.new("SpecialMesh")
- Script38 = Instance.new("Script")
- Pants39 = Instance.new("Pants")
- Shirt40 = Instance.new("Shirt")
- Script41 = Instance.new("Script")
- Script42 = Instance.new("Script")
- Script43 = Instance.new("Script")
- Model0.Name = "Communist"
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.BrickColor = BrickColor.new("Light orange")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.CFrame = CFrame.new(-0.208322003, 4.5000391, 1.03549194, 0.999992847, -8.12661223e-12, -1.49012322e-08, 8.19073628e-12, 1, 3.69057996e-12, 1.49012322e-08, -3.75279755e-12, 0.999992847)
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part1.Position = Vector3.new(-0.208322003, 4.5000391, 1.03549194)
- Part1.Color = Color3.new(0.917647, 0.721569, 0.572549)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal3.Parent = Part1
- Decal3.Texture = "http://www.roblox.com/asset/?id=221967384"
- Script4.Parent = Part1
- table.insert(cors,sandbox(Script4,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Script5.Name = "PlaySounds"
- Script5.Parent = Part1
- table.insert(cors,sandbox(Script5,function()
- zombieParent = false
- local soundIds = {113306429,111896685,113306429}
- local sounds = {}
- for i=1,#soundIds do
- local s = Instance.new("Sound")
- s.SoundId = "http://www.roblox.com/asset/?id=" .. soundIds[i]
- s.Volume = 1
- s.Parent = script.Parent
- sounds[#sounds + 1] = s
- end
- while zombieParent == false do
- wait(1)
- if script.Parent.Name == "Head" then
- zombieParent = true
- end
- end
- while true do
- wait(math.random(20,35))
- local i = math.random(1, #sounds)
- sounds[i].Pitch = 1
- sounds[i]:Play()
- end
- end))
- Weld6.Name = "HeadWeld"
- Weld6.Parent = Part1
- Weld6.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld6.C1 = CFrame.new(0, 0.349999994, 0, 1, 0, -0, 0, 0.995037258, 0.0995037109, 0, -0.0995037258, 0.995037138)
- Weld6.Part0 = Part1
- Weld6.Part1 = Part25
- Weld7.Name = "HeadWeld"
- Weld7.Parent = Part1
- Weld7.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld7.C1 = CFrame.new(0, -0.100000001, 0, 1, 0, -0, 0, 0.995037258, 0.0995037109, 0, -0.0995037258, 0.995037138)
- Weld7.Part0 = Part1
- Weld7.Part1 = Part34
- Part8.Name = "Torso"
- Part8.Parent = Model0
- Part8.BrickColor = BrickColor.new("Light orange")
- Part8.FormFactor = Enum.FormFactor.Symmetric
- Part8.Size = Vector3.new(2, 2, 1)
- Part8.CFrame = CFrame.new(-0.208322003, 3.00003505, 1.03549194, 1, -8.16947031e-12, -1.49012678e-08, 8.16947031e-12, 1, 3.73059353e-12, 1.49012678e-08, -3.73059353e-12, 1)
- Part8.LeftSurface = Enum.SurfaceType.Weld
- Part8.RightSurface = Enum.SurfaceType.Weld
- Part8.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part8.Position = Vector3.new(-0.208322003, 3.00003505, 1.03549194)
- Part8.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Motor6D9.Name = "Right Hip"
- Motor6D9.Parent = Part8
- Motor6D9.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.Part0 = Part8
- Motor6D9.Part1 = Part21
- Motor6D9.MaxVelocity = 0.10000000149012
- Motor6D10.Name = "Left Hip"
- Motor6D10.Parent = Part8
- Motor6D10.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.Part0 = Part8
- Motor6D10.Part1 = Part19
- Motor6D10.MaxVelocity = 0.10000000149012
- Weld11.Parent = Part8
- Weld11.C1 = CFrame.new(0.800000012, 0.5, 0.400000006, 0.766044438, 0, 0.642787576, -0.642787576, 1.19248806e-08, 0.766044438, -7.66516539e-09, -1, 9.13498877e-09)
- Weld11.Part0 = Part8
- Weld11.Part1 = Part14
- Weld12.Parent = Part8
- Weld12.C1 = CFrame.new(-1.20000005, 0.5, 0.400000006, 0.99619472, 0, -0.087155737, 0.087155737, 1.19248806e-08, 0.99619472, 1.03932174e-09, -1, 1.18795027e-08)
- Weld12.Part0 = Part8
- Weld12.Part1 = Part16
- Script13.Parent = Part8
- table.insert(cors,sandbox(Script13,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Part14.Name = "Left Arm"
- Part14.Parent = Model0
- Part14.BrickColor = BrickColor.new("Light orange")
- Part14.Rotation = Vector3.new(90, 0, 40)
- Part14.CanCollide = false
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.Size = Vector3.new(1, 2, 1)
- Part14.CFrame = CFrame.new(-0.499763787, 3.40003514, 0.138239622, 0.766044438, -0.642787576, -7.65699593e-09, 8.65615652e-12, 1.19224879e-08, -1, 0.642787576, 0.766044438, 9.13871911e-09)
- Part14.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part14.Position = Vector3.new(-0.499763787, 3.40003514, 0.138239622)
- Part14.Orientation = Vector3.new(90, -40, 0)
- Part14.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Script15.Parent = Part14
- table.insert(cors,sandbox(Script15,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Part16.Name = "Right Arm"
- Part16.Parent = Model0
- Part16.BrickColor = BrickColor.new("Light orange")
- Part16.Rotation = Vector3.new(90, 0, -5)
- Part16.CanCollide = false
- Part16.FormFactor = Enum.FormFactor.Symmetric
- Part16.Size = Vector3.new(1, 2, 1)
- Part16.CFrame = CFrame.new(0.943533838, 3.40003514, 0.432807684, 0.99619472, 0.0871557221, 1.04749098e-09, 7.81324051e-12, 1.19293091e-08, -1, -0.0871557221, 0.99619472, 1.18832331e-08)
- Part16.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part16.Position = Vector3.new(0.943533838, 3.40003514, 0.432807684)
- Part16.Orientation = Vector3.new(90, 5, 0)
- Part16.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Weld17.Name = "RightGrip"
- Weld17.Parent = Part16
- Weld17.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, 0)
- Weld17.C1 = CFrame.new(0, -0.200000003, 0.200000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Weld17.Part0 = Part16
- Weld17.Part1 = Part28
- Script18.Parent = Part16
- table.insert(cors,sandbox(Script18,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Part19.Name = "Left Leg"
- Part19.Parent = Model0
- Part19.BrickColor = BrickColor.new("Light orange")
- Part19.CanCollide = false
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.Size = Vector3.new(1, 2, 1)
- Part19.CFrame = CFrame.new(-0.708321989, 1.00003505, 1.03549194, 1, -8.16947031e-12, -1.49012678e-08, 8.16947031e-12, 1, 3.73059353e-12, 1.49012678e-08, -3.73059353e-12, 1)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part19.Position = Vector3.new(-0.708321989, 1.00003505, 1.03549194)
- Part19.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Script20.Parent = Part19
- table.insert(cors,sandbox(Script20,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Part21.Name = "Right Leg"
- Part21.Parent = Model0
- Part21.BrickColor = BrickColor.new("Light orange")
- Part21.CanCollide = false
- Part21.FormFactor = Enum.FormFactor.Symmetric
- Part21.Size = Vector3.new(1, 2, 1)
- Part21.CFrame = CFrame.new(0.291678011, 1.00003505, 1.03549194, 1, -8.16947031e-12, -1.49012678e-08, 8.16947031e-12, 1, 3.73059353e-12, 1.49012678e-08, -3.73059353e-12, 1)
- Part21.BottomSurface = Enum.SurfaceType.Smooth
- Part21.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part21.Position = Vector3.new(0.291678011, 1.00003505, 1.03549194)
- Part21.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Script22.Parent = Part21
- table.insert(cors,sandbox(Script22,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Humanoid23.Name = "Zombie"
- Humanoid23.Parent = Model0
- Humanoid23.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid23.RightLeg = Part21
- Humanoid23.LeftLeg = Part19
- Humanoid23.Torso = Part8
- Humanoid23.Health = 135
- Humanoid23.MaxHealth = 135
- Humanoid23.WalkSpeed = 18
- Hat24.Name = "Millitary Beanie"
- Hat24.Parent = Model0
- Hat24.AttachmentForward = Vector3.new(0, -0.0995037109, -0.995037138)
- Hat24.AttachmentPos = Vector3.new(0, 0.349999994, 0)
- Hat24.AttachmentUp = Vector3.new(0, 0.995037258, -0.0995037258)
- Part25.Name = "Handle"
- Part25.Parent = Hat24
- Part25.BrickColor = BrickColor.new("Bright red")
- Part25.Rotation = Vector3.new(5.71000004, 0, 0)
- Part25.CanCollide = false
- Part25.FormFactor = Enum.FormFactor.Symmetric
- Part25.Size = Vector3.new(1, 1, 1)
- Part25.CFrame = CFrame.new(-0.208322003, 4.65177631, 1.0006659, 0.999992847, -1.49081425e-09, -1.48264716e-08, 8.19073628e-12, 0.995037258, -0.0995037258, 1.49012322e-08, 0.0995029956, 0.995030046)
- Part25.BottomSurface = Enum.SurfaceType.Smooth
- Part25.TopSurface = Enum.SurfaceType.Smooth
- Part25.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part25.Position = Vector3.new(-0.208322003, 4.65177631, 1.0006659)
- Part25.Orientation = Vector3.new(5.71000004, 0, 0)
- Part25.Color = Color3.new(0.768628, 0.156863, 0.109804)
- SpecialMesh26.Parent = Part25
- SpecialMesh26.MeshId = "http://www.roblox.com/asset/?id=9466401"
- SpecialMesh26.Scale = Vector3.new(1, 1.10000002, 0.850000024)
- SpecialMesh26.TextureId = "http://www.roblox.com/asset/?id=9466384"
- SpecialMesh26.MeshType = Enum.MeshType.FileMesh
- SpecialMesh26.Scale = Vector3.new(1, 1.10000002, 0.850000024)
- Script27.Name = "Control"
- Script27.Parent = Model0
- table.insert(cors,sandbox(Script27,function()
- wait(.1)
- local ammo=15 -- How much ammo the Enemy has
- local w=.14
- local r=false
- local t=script.Parent
- Spawn(function()
- local c=t:Clone()
- wait(1)
- t.Humanoid.Died:wait()
- wait(3)
- c.Parent=workspace
- c:MakeJoints()
- t:Destroy()
- end)
- local cf={CFrame.new(.8,.5,.4)*CFrame.Angles(math.rad(270),math.rad(40),0),CFrame.new(-1.2,0.5,0.4)*CFrame.Angles(math.rad(270),math.rad(-5),0)}
- local c=LoadLibrary'RbxUtility'.Create
- local b1=c'Part'{TopSurface=0;BottomSurface=0;Anchored=true;CanCollide=false;BrickColor=BrickColor.White();Size=Vector3.new(.2,.2,1);c'SpecialMesh'{MeshType=6;Scale=Vector3.new(.2,.2,1)}}
- local b2=b1:Clone()
- b1.Name,b2.Name='1','2'
- local mov=c'Part'{Transparency=1;CanCollide=false;Parent=t;Anchored=true}
- local h=t:WaitForChild'Handle'
- local function reload(boo)
- if(boo and ammo~=30)or ammo==0 then
- r=true
- if w then
- w=.03
- end
- h.Reload:Play()
- wait(6) -- How long the Enemy reloads
- ammo=3
- if w then
- w=.14
- end
- r=false
- elseif boo then
- wait(.1)
- end
- end
- local function near()
- local dis,pl=5000,nil -- Range of the Enemy
- for _,v in ipairs(game.Players:GetPlayers())do
- if v.Character and v.Character:FindFirstChild'Humanoid'and v:DistanceFromCharacter(h.Position)<dis then
- dis,pl=v:DistanceFromCharacter(h.Position),v
- end
- end
- if pl then
- return pl.Character:GetModelCFrame(),dis,CFrame.new(pl.Character.Humanoid.WalkToPoint).lookVector
- else
- return nil
- end
- end
- Spawn(function()
- while true do
- t.Humanoid.Jump=false
- while not w do wait(.1)end
- for i=1,math.random(4,9)do
- wait(w)
- end
- end
- end)
- Spawn(function()
- while wait(math.random(2,7)/10)do
- local n=near()
- if n and math.random(1,3)==2 or not n then
- mov.CFrame=t.Torso.CFrame+t.Torso.CFrame.lookVector*Vector3.new(math.random(-25,25),0,math.random(-25,25))
- else
- mov.CFrame=n+Vector3.new((math.random(1,2)==1 and 1 or -1)*math.random(25,50),0,(math.random(1,2)==1 and 1 or -1)*math.random(25,50))
- end
- wait(.1)
- t.Zombie:MoveTo(mov.Position,mov)
- end
- end)
- while true do
- local n,mag,hum=near()
- if n then
- n=n.p
- if not r then
- w=.14
- local dir=h.Position-n
- local tst,_=workspace:FindPartOnRay(Ray.new(t.Torso.Position,(n-t.Torso.Position).Unit*999),t)
- local aim=n+Vector3.new(math.random(-mag*.015,mag*.015),math.random(-mag*.015,mag*.015),math.random(-mag*.015,mag*.015))*(2+math.random())+hum
- if tst and tst.Parent and game.Players:GetPlayerFromCharacter(tst.Parent)then
- wait(.1)
- h.Fire:Play()
- local par,pos=workspace:FindPartOnRay(Ray.new(h.Position,(aim-h.Position).Unit*999),t)
- if par then
- local h=par.Parent:FindFirstChild'Humanoid'or par.Parent.Parent:FindFirstChild'Humanoid'
- if h and h.Health-10>0 then
- h.Health=h.Health-5 -- How much damage the gun inflicts
- elseif h then
- h.Health=0
- h.Parent:BreakJoints()
- end
- end
- ammo=ammo-1
- mag=(h.Position-pos).magnitude
- b1.Parent,b2.Parent=t,t
- b1.CFrame,b2.CFrame=CFrame.new(h.Position:Lerp(pos,.3),pos),CFrame.new(pos:Lerp(h.Position,.175),h.Position) -- Gun Accuracy (ONLY EDIT IF YOU KNOW WHAT TO DO)
- b1.Mesh.Scale,b2.Mesh.Scale=Vector3.new(.2,.2,mag*.75),Vector3.new(.2,.2,mag/4)
- Delay(.03,function()b1.Parent=nil wait(.03)b2.Parent=nil end)
- end
- wait(.045) -- How fast the enemy shoots
- if ammo==0 then
- reload()
- end
- end
- else
- reload(true)
- w=false
- end
- end
- -- Dellkiller123
- end))
- Part28.Name = "Handle"
- Part28.Parent = Model0
- Part28.BrickColor = BrickColor.new("Light orange")
- Part28.Transparency = 1
- Part28.Rotation = Vector3.new(-180, 85, 180)
- Part28.CanCollide = false
- Part28.FormFactor = Enum.FormFactor.Symmetric
- Part28.Size = Vector3.new(2, 1, 1)
- Part28.CFrame = CFrame.new(0.657139182, 3.60003519, -0.545955896, -0.0871557221, -1.04749098e-09, 0.99619472, -1.19293091e-08, 1, 7.81324051e-12, -0.99619472, -1.18832331e-08, -0.0871557221)
- Part28.RightSurface = Enum.SurfaceType.Hinge
- Part28.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part28.Position = Vector3.new(0.657139182, 3.60003519, -0.545955896)
- Part28.Orientation = Vector3.new(0, 95, 0)
- Part28.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Sound29.Name = "Reload"
- Sound29.Parent = Part28
- Sound29.SoundId = "http://www.roblox.com/asset/?id=132456279"
- Sound29.Volume = 0.10000000149012
- Sound30.Name = "Fire"
- Sound30.Parent = Part28
- Sound30.SoundId = "http://www.roblox.com/asset/?id=139711658"
- Sound30.Volume = 1
- Script31.Parent = Part28
- table.insert(cors,sandbox(Script31,function()
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid~=nil then
- humanoid:TakeDamage(25)
- end
- end
- connection = script.Parent.Touched:connect(blow)
- end))
- Script32.Name = "MoneyKill"
- Script32.Parent = Model0
- table.insert(cors,sandbox(Script32,function()
- --[[Edited by kirbycaden to make it easier to work with, original was made by some free modeler. Thank you for using a script
- that.]]--
- Stat2 = true --Make this either true or false depending if you want something else to go be increased in leaderstats.
- StatName = "KOs" --Name of stats.
- IncreaseValue = 1 --Increase in Money/Cash/Points etc.
- Stat2Name = "Kills" --SecondStat name
- IncreaseValue2 = 1 --SecondStat increase value.
- local Humanoid = script.Parent.Zombie --If your zombies have "Zombie" instead of "Humanoid", make this Zombie.
- function PwntX_X()
- local tag = Humanoid:findFirstChild("creator")
- if tag ~= nil then
- if tag.Value ~= nil then
- local Leaderstats = tag.Value:findFirstChild("leaderstats")
- if Leaderstats ~= nil then
- Leaderstats[StatName].Value = Leaderstats[StatName].Value + IncreaseValue --Change Money to the stat that is increased.
- if Stat2 == true then
- Leaderstats[Stat2Name].Value = Leaderstats[Stat2Name].Value + IncreaseValue2
- wait(0.1)
- script:remove()
- end
- end
- end
- end
- end
- Humanoid.Died:connect(PwntX_X)
- end))
- Hat33.Name = "Millitary Beanie"
- Hat33.Parent = Model0
- Hat33.AttachmentForward = Vector3.new(0, -0.0995037109, -0.995037138)
- Hat33.AttachmentPos = Vector3.new(0, -0.100000001, 0)
- Hat33.AttachmentUp = Vector3.new(0, 0.995037258, -0.0995037258)
- Part34.Name = "Handle"
- Part34.Parent = Hat33
- Part34.BrickColor = BrickColor.new("Bright red")
- Part34.Rotation = Vector3.new(5.71000004, 0, 0)
- Part34.CanCollide = false
- Part34.FormFactor = Enum.FormFactor.Symmetric
- Part34.Size = Vector3.new(1, 1, 1)
- Part34.CFrame = CFrame.new(-0.208322003, 5.09954262, 1.04544222, 0.999992847, -1.49081425e-09, -1.48264716e-08, 8.19073628e-12, 0.995037258, -0.0995037258, 1.49012322e-08, 0.0995029956, 0.995030046)
- Part34.BottomSurface = Enum.SurfaceType.Smooth
- Part34.TopSurface = Enum.SurfaceType.Smooth
- Part34.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part34.Position = Vector3.new(-0.208322003, 5.09954262, 1.04544222)
- Part34.Orientation = Vector3.new(5.71000004, 0, 0)
- Part34.Color = Color3.new(0.768628, 0.156863, 0.109804)
- SpecialMesh35.Parent = Part34
- SpecialMesh35.MeshId = "http://www.roblox.com/asset/?id=76696701"
- SpecialMesh35.Scale = Vector3.new(1.26999998, 1.37, 1.26999998)
- SpecialMesh35.TextureId = "http://www.roblox.com/asset/?id=121377688"
- SpecialMesh35.MeshType = Enum.MeshType.FileMesh
- SpecialMesh35.Scale = Vector3.new(1.26999998, 1.37, 1.26999998)
- Part36.Parent = Model0
- Part36.BrickColor = BrickColor.new("Light orange")
- Part36.Rotation = Vector3.new(0, 5, 0)
- Part36.CanCollide = false
- Part36.FormFactor = Enum.FormFactor.Custom
- Part36.Size = Vector3.new(1, 0.200000003, 2)
- Part36.CFrame = CFrame.new(0.657119393, 4.20004225, -0.545908213, 0.996187568, -1.04743259e-09, 0.087155126, 7.85868159e-12, 1, 1.19289476e-08, -0.087155126, -1.18828343e-08, 0.996187568)
- Part36.TopSurface = Enum.SurfaceType.Smooth
- Part36.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part36.Position = Vector3.new(0.657119393, 4.20004225, -0.545908213)
- Part36.Orientation = Vector3.new(0, 5, 0)
- Part36.Color = Color3.new(0.917647, 0.721569, 0.572549)
- SpecialMesh37.Parent = Part36
- SpecialMesh37.MeshId = "http://www.roblox.com/asset/?id=3824749"
- SpecialMesh37.Offset = Vector3.new(-0.174999997, -0.600000024, -0.174999997)
- SpecialMesh37.Scale = Vector3.new(1.70000005, 1.29999995, 1.10000002)
- SpecialMesh37.TextureId = "http://www.roblox.com/asset/?id=159740858"
- SpecialMesh37.VertexColor = Vector3.new(0.699999988, 0.699999988, 0.699999988)
- SpecialMesh37.MeshType = Enum.MeshType.FileMesh
- SpecialMesh37.Scale = Vector3.new(1.70000005, 1.29999995, 1.10000002)
- Script38.Name = "RaceGenerator"
- Script38.Parent = Model0
- table.insert(cors,sandbox(Script38,function()
- colors={"Brick yellow", "Light orange", "Nougat", "Bright orange"}
- Color=BrickColor.new(colors[math.random(1,6)])
- for i,v in pairs(script.Parent:GetChildren()) do
- if v.Name=='Head' or v.Name=='Right Leg' or v.Name=='Right Arm' or v.Name=='Left Arm' or v.Name=='Left Leg' or v.Name=='Torso' then
- v.BrickColor=Color
- end
- end
- end))
- Pants39.Name = "Pants"
- Pants39.Parent = Model0
- Pants39.PantsTemplate = "http://www.roblox.com/asset/?id=221961768"
- Shirt40.Name = "Shirt"
- Shirt40.Parent = Model0
- Shirt40.ShirtTemplate = "http://www.roblox.com/asset/?id=221961698"
- Script41.Name = "spawnHandler"
- Script41.Parent = Model0
- table.insert(cors,sandbox(Script41,function()
- local NPC = script.Parent
- local cln=NPC:Clone()
- local Config = NPC.Configuration
- local Head, Torso, LArm, RArm, LLeg, RLeg = NPC.Head, NPC.Torso, NPC['Left Arm'], NPC['Right Arm'], NPC['Left Leg'], NPC['Right Leg'];
- local Humanoid;
- print('Starting bot setup')
- -- Preset config
- Config.HumanoidReady.Value = false;
- -- Make sure parts are anchored
- function anchor(bool)
- for _,child in pairs(script.Parent:GetChildren()) do
- if child:IsA('Part') and child.Name~='MoveHere' then
- child.Anchored=bool
- end
- end
- end
- anchor(true)
- function Join(MainPart, LegacyPart, Parent, C0, C1)
- local Joint = Instance.new("Motor");
- Joint.Part0 = MainPart
- Joint.Part1 = LegacyPart
- Joint.C0 = C0
- Joint.C1 = C1
- Joint.Parent = Parent -- !Important: Without parenting last, the C1 and C0 will take affect and prematurely move the parts.
- return Joint;
- end
- for _,child in pairs(script.Parent:children()) do
- if child:IsA('Part') then
- Join(Torso,child,Torso,CFrame.new(),child.CFrame:toObjectSpace(Torso.CFrame))
- end
- end
- -- -- Build NPC
- -- --Join(script.Parent['Right Arm'],script.Parent.Handle, script.Parent['Right Arm'] ,CFrame.new(),script.Parent.Handle.CFrame:toObjectSpace(script.Parent['Right Arm'].CFrame));
- -- print('Welded Gun')
- -- Join(Torso,script.Parent.Hat1, Torso,CFrame.new(),script.Parent.Hat1.CFrame:toObjectSpace(Torso.CFrame));
- -- Join(Torso,script.Parent.Hat2, Torso,CFrame.new(),script.Parent.Hat2.CFrame:toObjectSpace(Torso.CFrame));
- -- Join(Torso, Head, Torso, CFrame.new(), Head.CFrame:toObjectSpace(Torso.CFrame));
- -- Join(Torso, script.Parent['Left Arm'], Torso, CFrame.new(), script.Parent['Left Arm'].CFrame:toObjectSpace(Torso.CFrame));
- -- Join(Torso, script.Parent['Right Arm'], Torso, CFrame.new(), script.Parent['Right Arm'].CFrame:toObjectSpace(Torso.CFrame));
- -- Join(Torso, LLeg, Torso, CFrame.new(0.5,-1,0), CFrame.new(0,1,0));
- -- Join(Torso, RLeg, Torso, CFrame.new(-0.5,-1,0), CFrame.new(0,1,0));
- Humanoid = Instance.new("Humanoid");
- Humanoid.Name = "Zombie";
- Humanoid.Parent = NPC;
- Config.HumanoidReady.Value = true;
- wait()
- anchor(false)
- Humanoid.Died:connect(function()
- wait(3)
- local np=cln
- cln.Parent=workspace
- NPC:Remove()
- end)
- end))
- Script42.Name = "Respawn"
- Script42.Parent = Model0
- table.insert(cors,sandbox(Script42,function()
- name="Zombie"
- robo=script.Parent:clone()
- while true do
- wait(20)
- if script.Parent.Zombie.Health<1 then
- robot=robo:clone()
- robot.Parent=script.Parent.Parent
- robot:makeJoints()
- script.Parent:remove()
- end
- end
- end))
- Script43.Name = "Robot"
- Script43.Parent = Model0
- table.insert(cors,sandbox(Script43,function()
- miked=script.Parent
- itlh=miked.Torso:findFirstChild("Left Hip")
- itlh.Part0=miked.Torso
- itlh.Part1=miked:findFirstChild("Left Leg")
- itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- itrh=miked.Torso:findFirstChild("Right Hip")
- itrh.Part0=miked.Torso
- itrh.Part1=miked:findFirstChild("Right Leg")
- itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- itls=miked.Torso:findFirstChild("Left Shoulder")
- itls.Part1=miked.Torso
- itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- itls.Part0=miked:findFirstChild("Left Arm")
- itrs=miked.Torso:findFirstChild("Right Shoulder")
- itrs.Part1=miked.Torso
- itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- itrs.Part0=miked:findFirstChild("Right Arm")
- miked.Head:makeJoints()
- ------------------
- ------------------
- function waitForChild(parent, childName)
- while true do
- local child = parent:findFirstChild(childName)
- if child then
- return child
- end
- parent.ChildAdded:wait()
- end
- end
- local Figure = script.Parent
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local toolAnim = "None"
- local toolAnimTime = 0
- local isSeated = false
- function onRunning(speed)
- if isSeated then return end
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- isSeated = false
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onDancing()
- pose = "Dancing"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- isSeated = true
- pose = "Seated"
- end
- function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1
- LeftShoulder.DesiredAngle = -1
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFloat()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.57
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = -1.57
- end
- function moveBoogy()
- while pose=="Boogy" do
- wait(.5)
- RightShoulder.MaxVelocity = 1
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(.5)
- RightShoulder.MaxVelocity = 1
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 1.57
- end
- end
- function moveZombie()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.57
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function movePunch()
- script.Parent.Torso.Anchored=true
- RightShoulder.MaxVelocity = 60
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- wait(1)
- script.Parent.Torso.Anchored=false
- pose="Standing"
- end
- function moveKick()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.MaxVelocity = 40
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(1)
- pose="Standing"
- end
- function moveFly()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.MaxVelocity = 40
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(1)
- pose="Standing"
- end
- function moveClimb()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = 3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = -3.14 /2
- LeftShoulder.DesiredAngle = -3.14 /2
- RightHip.DesiredAngle = 3.14 /2
- LeftHip.DesiredAngle = -3.14 /2
- end
- function getTool()
- kidTable = Figure:children()
- if (kidTable ~= nil) then
- numKids = #kidTable
- for i=1,numKids do
- if (kidTable[i].className == "Tool") then return kidTable[i] end
- end
- end
- return nil
- end
- function getToolAnim(tool)
- c = tool:children()
- for i=1,#c do
- if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
- return c[i]
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder.DesiredAngle = -1.57
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "Zombie") then
- moveZombie()
- return
- end
- if (pose == "Boogy") then
- moveBoogy()
- return
- end
- if (pose == "Float") then
- moveFloat()
- return
- end
- if (pose == "Punch") then
- movePunch()
- return
- end
- if (pose == "Kick") then
- moveKick()
- return
- end
- if (pose == "Fly") then
- moveFly()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Climbing") then
- moveClimb()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- amplitude = 0.1
- frequency = 1
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- if (pose == "Running") then
- amplitude = 1
- frequency = 9
- elseif (pose == "Dancing") then
- amplitude = 2
- frequency = 16
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- if pose~="Dancing" then
- RightShoulder.DesiredAngle = -desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- else
- RightShoulder.DesiredAngle = desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- end
- local tool = getTool()
- if tool ~= nil then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject ~= nil then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- -- connect events
- -----------------------------------------------------------------------------------------------------------------------
- function unequip()
- local items=script.Parent:children()
- for i=1, #items do
- if items[i].className=="Tool" then items[i]:remove() end
- end
- end
- function onChatted(msg, recipient)
- msg = string.lower(msg)
- if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
- if string.match(msg, "equip") then
- if game.Workspace:findFirstChild("Hub") then
- if string.match(msg, "rocket") then unequip()
- game.Workspace.Hub.Rocket:clone().Parent=script.Parent
- elseif string.match(msg, "slingshot") then unequip()
- game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
- elseif string.match(msg, "sword") then unequip()
- game.Workspace.Hub.Sword:clone().Parent=script.Parent
- elseif string.match(msg, "pbg") then unequip()
- game.Workspace.Hub.PBG:clone().Parent=script.Parent
- elseif string.match(msg, "superball") then unequip()
- game.Workspace.Hub.Superball:clone().Parent=script.Parent
- elseif string.match(msg, "trowel") then unequip()
- game.Workspace.Hub.Trowel:clone().Parent=script.Parent
- elseif string.match(msg, "bomb") then unequip()
- game.Workspace.Hub.Bomb:clone().Parent=script.Parent
- end
- end
- end
- if string.match(msg, "unequip") then unequip() end
- if string.match(msg, "run") then onRunning(1) end
- if string.match(msg, "climb") then onClimbing() end
- if string.match(msg, "jump") then onJumping() end
- if string.match(msg, "zombie") then pose="Zombie" end
- if string.match(msg, "disco") then pose="Boogy" end
- if string.match(msg, "float") then pose="Float" end
- if string.match(msg, "punch") then pose="Punch" end
- if string.match(msg, "kick") then pose="Kick" end
- if string.match(msg, "fly") then pose="Fly" end
- if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
- if string.match(msg, "defend") then defence() end
- if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
- if string.match(msg, "go home") then following=false; gohome() end
- if string.match(msg, "follow") then
- if string.match(msg, "all") then
- followany()
- else
- local egg=game.Players:children()
- for i=1, #egg do
- if string.match(msg, string.lower(egg[i].Name)) then
- follow(egg[i].Name)
- return
- end
- end
- end
- end
- if string.match(msg, "kill") then
- if string.match(msg, "all") then
- attackany()
- else
- local egg=game.Players:children()
- for i=1, #egg do
- if string.match(msg, string.lower(egg[i].Name)) then
- attack(egg[i].Name)
- return
- end
- end
- end
- end
- end
- end
- if game.Players.NumPlayers>1 then
- x=game.Players:children()
- for i=1, #x do
- if script.Parent:findFirstChild("Commander")~=nil then
- if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
- local ch=script.Parent.Commander:children()
- for i=1, #ch do
- if string.lower(ch[i].Name)==string.lower(x[i].Name) then
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- else
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- end
- function onPlayerEntered(Player)
- while Player.Name==nil do
- wait(2)
- end
- if script.Parent:findFirstChild("Commander")~=nil then
- if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
- local ch=script.Parent.Commander:children()
- for i=1, #ch do
- if string.lower(ch[i].Name)==string.lower(Player.Name) then
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- else
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- game.Players.ChildAdded:connect(onPlayerEntered)
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- dist=20
- function followany()
- following=true
- while following==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local l=game.Workspace:findFirstChild(ch[i].Name)
- if l~=nil then
- local s=l.Torso
- local p=l.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if smallest==nil then
- smallest=d
- target=s
- elseif d<smallest then
- smallest=d
- target=s
- end
- end
- end
- if smallest==nil then stopmoving() return end
- if smallest>6*dist then return end
- script.Parent.Humanoid:MoveTo(target.Position, target)
- wait(0.5)
- for i=1, 6 do
- if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
- end
- end
- end
- function gohome()
- script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
- end
- function stopmoving()
- script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
- end
- function follow(name)
- following=true
- local p=game.Workspace:findFirstChild(name)
- if p==nil then return end
- while following==true do
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
- wait(0.5)
- for i=1, 3 do
- if p.Humanoid.Health<1 then following=false; stopmoving() return end
- wait(0.5)
- end
- end
- end
- function attack(name)
- if script.Parent:findFirstChild("Sword")~=nil then
- following=true
- local p=game.Workspace:findFirstChild(name)
- if p==nil then return end
- while following==true do
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
- wait(0.5)
- for i=1, 3 do
- if p.Humanoid.Health<1 then following=false; stopmoving() return end
- local l=p.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
- if d<10 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
- if (q.y-l.y)>3 and (q.y-l.y)<7 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
- end
- end
- wait(1)
- end
- end
- end
- end
- function attackany()
- if script.Parent:findFirstChild("Sword")~=nil then
- following=true
- while following==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local l=game.Workspace:findFirstChild(ch[i].Name)
- if l~=nil then
- local s=l.Torso
- local p=l.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if smallest==nil then
- smallest=d
- target=s
- elseif d<smallest then
- smallest=d
- target=s
- end
- end
- end
- if smallest==nil then stopmoving() return end
- if smallest>6*dist then return end
- script.Parent.Humanoid:MoveTo(target.Position, target)
- if smallest<10 then
- slash()
- end
- if target.Parent==nil then stopmoving() return end
- wait(0.5)
- for i=1, 3 do
- if target.Parent.Humanoid.Health<1 then
- stopmoving()
- else
- local p=target.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if d<10 then
- script.Parent.Humanoid:MoveTo(target.Position, target); slash()
- if (q.y-p.y)>3 and (q.y-p.y)<7 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
- end
- end
- wait(1)
- end
- end
- end
- end
- end
- function patrol()
- if points==nil then
- points=0
- if game.Workspace:findFirstChild("pp1")~=nil then
- pp1=game.Workspace:findFirstChild("pp1")
- local points=points+1
- if game.Workspace:findFirstChild("pp2")~=nil then
- pp2=game.Workspace:findFirstChild("pp2")
- local points=points+1
- if game.Workspace:findFirstChild("pp3")~=nil then
- pp3=game.Workspace:findFirstChild("pp3")
- local points=points+1
- if game.Workspace:findFirstChild("pp4")~=nil then
- pp4=game.Workspace:findFirstChild("pp4")
- local points=points+1
- if game.Workspace:findFirstChild("pp5")~=nil then
- pp5=game.Workspace:findFirstChild("pp5")
- local points=points+1
- if game.Workspace:findFirstChild("pp6")~=nil then
- pp6=game.Workspace:findFirstChild("pp6")
- local points=points+1
- if game.Workspace:findFirstChild("pp7")~=nil then
- pp7=game.Workspace:findFirstChild("pp7")
- local points=points+1
- if game.Workspace:findFirstChild("pp8")~=nil then
- pp8=game.Workspace:findFirstChild("pp8")
- local points=points+1
- if game.Workspace:findFirstChild("pp9")~=nil then
- pp9=game.Workspace:findFirstChild("pp9")
- local points=points+1
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- if points<1 then return end
- patrolling=true
- local time=2
- if points==1 then return end
- if points>1 then
- while patrolling==true do
- script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
- wait(time)
- script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
- wait(time)
- if points>2 then
- script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
- wait(time)
- if points>3 then
- script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
- wait(time)
- if points>4 then
- script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
- wait(time)
- if points>5 then
- script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
- wait(time)
- if points>6 then
- script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
- wait(time)
- if points>7 then
- script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
- wait(time)
- if points>8 then
- script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
- wait(time)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function goto(pos,part)
- while true do
- end
- end
- function slash()
- for i=1, 3 do
- wait(.3)
- RightShoulder.MaxVelocity = 2
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = -2.14
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- wait(.2)
- RightShoulder.MaxVelocity = 2
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- end
- function defence()
- proxkill=true
- while proxkill==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local p=game.Workspace:findFirstChild(ch[i].Name)
- if p~=nil then
- local p=p.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if d<dist and d>8 then
- local ex=Instance.new("Explosion")
- ex.Position=p
- ex.Parent=game.Workspace
- end
- end
- end
- wait(1)
- end
- end
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- --[[
- function newSound(id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Parent = script.Parent.Head
- return sound
- end
- local sDied = newSound("rbxasset://sounds/uuhhh.wav")
- local sFallingDown = newSound("rbxasset://sounds/splat.wav")
- local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
- local sGettingUp = newSound("rbxasset://sounds/hit.wav")
- local sJumping = newSound("rbxasset://sounds/button.wav")
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
- sRunning.Looped = true
- local Figure = script.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- function onDied()
- sDied:play()
- end
- function onState(state, sound)
- if state then
- sound:play()
- else
- sound:pause()
- end
- end
- function onRunning(speed)
- if speed>0 then
- sRunning:play()
- else
- sRunning:pause()
- end
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
- Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
- Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
- Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
- --]]
- local nextTime = 0
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- time = runService.Stepped:wait()
- if time > nextTime then
- move(time)
- nextTime = time + 0.1
- end
- end
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement