Advertisement
DaOMEGAa32

fe aaara

Nov 12th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.28 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152.  
  153. --go duck
  154. --note. this is a stupid script
  155. --lets get moms credit card
  156. Player = game.Players.LocalPlayer
  157. Mouse = Player:GetMouse()
  158. Mouse.KeyDown:Connect(function(key)
  159. key = key:lower()
  160. if key == "e" then
  161. local x = Instance.new("Part")
  162. x.Shape = "Ball"
  163. x.CanCollide = false
  164. x.Anchored = false
  165. x.CFrame = Player.Character.Torso.CFrame * CFrame.new(0,3,-12)
  166. local v = Instance.new("BodyVelocity", x)
  167. v.Velocity = Player.Character.Torso.CFrame.lookVector * 90
  168.  
  169. v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  170. x.Parent = workspace
  171.  
  172. end
  173.  
  174.  
  175. end)
  176. Player = game.Players.LocalPlayer
  177. Mouse = Player:GetMouse()
  178. Mouse.KeyDown:Connect(function(key)
  179. key = key:lower()
  180. if key == "r" then
  181. local s = Instance.new("Sound")
  182.  
  183. s.Name = "Name"
  184. s.SoundId = "rbxassetid://2568843432"
  185. s.Volume = 4
  186. s.Looped = false
  187. s.archivable = false
  188.  
  189. s.Parent = game.Workspace
  190.  
  191. wait(0.2)
  192.  
  193. s:play()
  194.  
  195. end
  196.  
  197.  
  198. end)
  199. print ("wired by me. go duck sr.")
  200. print ("I SEE U FOUND A WIRED SCRIPT")
  201. print ("WHEN A DAY U GOT A PIG. A CANT SPELL PIG. AND HE MAYBE SING. I DUNNOOOOOOOOOOOOOOOOO")
  202. print ("AND THEY SAW NOOBS ACROSS THE STREET.........")
  203. warn ("by zeddikuss123")
  204. print ("controls. ee- throw a ball")
  205. print ("rr. sqweek")
  206. print ("yy. P O O P")
  207. print ("using the lord of pigs can summon demon pigs")
  208. --
  209. -----the crappy starting
  210. --
  211.  
  212.  
  213. local s = Instance.new("Sound")
  214.  
  215. s.Name = "Name"
  216. s.SoundId = "rbxassetid://598782463"
  217. s.Volume = 4
  218. s.Looped = true
  219. s.archivable = false
  220.  
  221. s.Parent = game.Workspace
  222.  
  223. wait(0.2)
  224.  
  225. s:play()
  226. local pchar = game.Players.LocalPlayer.Character -- Can change player here --
  227.  
  228. for i,v in pairs(pchar.Torso:GetChildren()) do
  229. if v.ClassName == 'Decal' then
  230. v:Destroy()
  231. end
  232. end
  233. for i,v in pairs(pchar:GetChildren()) do
  234. if v.ClassName == 'Hat' then
  235. v:Destroy()
  236. end
  237. end
  238.  
  239. for i,v in pairs(pchar.Head:GetChildren()) do
  240. if v.ClassName == 'Decal' then
  241. v:Destroy()
  242. end
  243. end
  244. --
  245. ---generating
  246. --
  247. local duck = Instance.new('SpecialMesh', pchar.Torso)
  248. duck.MeshType = 'FileMesh'
  249. duck.MeshId = 'rbxassetid://1719079794'
  250. duck.TextureId = 'rbxassetid://1719079844'
  251. duck.Scale = Vector3.new(0.1, 0.1, 0.1)
  252. pchar.Head.Transparency = 1
  253. pchar['Left Arm'].Transparency = 1
  254. pchar['Right Arm'].Transparency = 1
  255. pchar['Left Leg'].Transparency = 1
  256. pchar['Right Leg'].Transparency = 1
  257. CV="White"
  258.  
  259. p = game.Players.LocalPlayer
  260. char = p.Character
  261. local txt = Instance.new("BillboardGui", char)
  262. txt.Adornee = char .Head
  263. txt.Name = "_status"
  264. txt.Size = UDim2.new(2, 0, 1.2, 0)
  265. txt.StudsOffset = Vector3.new(-9, 8, 0)
  266. local text = Instance.new("TextLabel", txt)
  267. text.Size = UDim2.new(10, 0, 7, 0)
  268. text.FontSize = "Size24"
  269. text.TextScaled = true
  270. text.TextTransparency = 0
  271. text.BackgroundTransparency = 1
  272. text.TextTransparency = 0
  273. text.TextStrokeTransparency = 1
  274. text.Font = "Highway"
  275. text.TextStrokeColor3 = Color3.fromRGB(255,0,0)
  276.  
  277. v=Instance.new("Part")
  278. v.Name = "ColorBrick"
  279. v.Parent=p.Character
  280. v.FormFactor="Symmetric"
  281. v.Anchored=true
  282. v.CanCollide=false
  283. v.BottomSurface="Smooth"
  284. v.TopSurface="Smooth"
  285. v.Size=Vector3.new(10,5,3)
  286. v.Transparency=1
  287. v.CFrame=char.Torso.CFrame
  288. v.BrickColor=BrickColor.new(CV)
  289. v.Transparency=1
  290. text.TextColor3 = Color3.fromRGB(255,192,203)
  291. v.Shape="Block"
  292. text.Text = "guinea pig"
  293. --
  294. --other crap
  295. --
  296.  
  297. --Converted with ttyyuu12345's model to script plugin v4
  298. function sandbox(var,func)
  299. local env = getfenv(func)
  300. local newenv = setmetatable({},{
  301. __index = function(self,k)
  302. if k=="script" then
  303. return var
  304. else
  305. return env[k]
  306. end
  307. end,
  308. })
  309. setfenv(func,newenv)
  310. return func
  311. end
  312. cors = {}
  313. mas = Instance.new("Model",game:GetService("Lighting"))
  314. Tool0 = Instance.new("Tool")
  315. Part1 = Instance.new("Part")
  316. SpecialMesh2 = Instance.new("SpecialMesh")
  317. Script3 = Instance.new("Script")
  318. Script4 = Instance.new("Script")
  319. Script5 = Instance.new("Script")
  320. Script6 = Instance.new("Script")
  321. Script7 = Instance.new("Script")
  322. Script8 = Instance.new("Script")
  323. Sound9 = Instance.new("Sound")
  324. Sound10 = Instance.new("Sound")
  325. Sound11 = Instance.new("Sound")
  326. Tool0.Name = "ZombieStaff"
  327. Tool0.Parent = mas
  328. Tool0.TextureId = "http://www.roblox.com/asset/?id=26337878"
  329. Tool0.Grip = CFrame.new(0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  330. Tool0.GripForward = Vector3.new(-0, -0, 1)
  331. Tool0.GripRight = Vector3.new(-1, 0, 0)
  332. Part1.Name = "Handle"
  333. Part1.Parent = Tool0
  334. Part1.CFrame = CFrame.new(44.3200378, 0.500189006, 9.29339027, -0.000186681747, -0.807089865, -0.590428591, -0.99999994, 1.18017197e-05, 0.000300019979, -0.000235140324, 0.590428591, -0.807089806)
  335. Part1.Orientation = Vector3.new(-0.0199999996, -143.809998, -90)
  336. Part1.Position = Vector3.new(44.3200378, 0.500189006, 9.29339027)
  337. Part1.Rotation = Vector3.new(-179.979996, -36.1899986, 90.0100021)
  338. Part1.Size = Vector3.new(1, 6, 1)
  339. Part1.Locked = true
  340. SpecialMesh2.Parent = Part1
  341. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=25922532"
  342. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=25922670"
  343. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  344. Script3.Name = "SummonZombies!"
  345. Script3.Parent = Tool0
  346. table.insert(cors,sandbox(Script3,function()
  347. Tool = script.Parent
  348.  
  349. local debris = game:service("Debris")
  350. zombies = 5
  351. reloadTime = 30
  352. Tool.Enabled = true
  353.  
  354. function fire(targetPos, humanoid)
  355.  
  356. insertZombies(targetPos, humanoid)
  357.  
  358. end
  359.  
  360. function insertZombies(pos, humanoid)
  361.  
  362. amountInFront = 15
  363. torsoNormal = humanoid.Parent.Torso.CFrame.lookVector
  364. denom = math.abs(torsoNormal.x) + math.abs(torsoNormal.z)
  365. posX = amountInFront * (torsoNormal.x/denom)
  366. posZ = amountInFront * (torsoNormal.z/denom)
  367. pos = Vector3.new(pos.x + posX,pos.y, pos.z + posZ)
  368.  
  369. smoker = Instance.new("Smoke")
  370.  
  371. smokeEmitter = Instance.new("Part")
  372. smokeEmitter.Size = Vector3.new(1,1,1)
  373. smokeEmitter.Transparency = 1
  374. smokeEmitter.Position = pos
  375. smokeEmitter.Anchored = true
  376. smokeEmitter.CanCollide = false
  377.  
  378. smoker.Parent = smokeEmitter
  379. smokeEmitter.Parent = game.Workspace
  380.  
  381. debris:AddItem(smokeEmitter, 10)
  382.  
  383. wait(1)
  384.  
  385.  
  386. for i = 1, 5 do
  387.  
  388. --This call will cause a "wait" until the data comes back
  389. local root = game:GetService("InsertService"):LoadAsset(4363576022)
  390.  
  391. local instances = root:GetChildren()
  392. if #instances == 0 then
  393. root:Remove()
  394. return
  395. end
  396.  
  397. --Continue the insert process
  398.  
  399. local zombeh = root.SummonedZombie
  400. zombeh.Owner.Value = humanoid
  401.  
  402. local keepYoHead = Instance.new("Weld")
  403. keepYoHead.Part0 = zombeh.Head
  404. keepYoHead.Part1 = zombeh.Torso
  405. keepYoHead.C0 = CFrame.new(0,-1.5,0)
  406. keepYoHead.Parent = zombeh.Head
  407.  
  408. local Robotron = Tool.Robot:clone()
  409. local Chaser = Tool.ChaseScript:clone()
  410. local SoundMan = Tool.PlaySounds:clone()
  411. local GarbageMan = Tool.Timer:clone()
  412. Chaser.Parent = zombeh
  413. Robotron.Parent = zombeh
  414. SoundMan.Parent = zombeh.Head
  415. GarbageMan.Parent = zombeh
  416. local spacing = 4
  417. --game:GetService("InsertService"):Insert(zombeh)
  418. zombeh.Parent = game.Workspace
  419. if i == 1 then
  420. zombeh:moveTo(Vector3.new(pos.x + spacing, pos.y,pos.z + spacing))
  421. elseif i == 2 then
  422. zombeh:moveTo(Vector3.new(pos.x - spacing, pos.y,pos.z + spacing))
  423. elseif i == 3 then
  424. zombeh:moveTo(Vector3.new(pos.x + spacing, pos.y,pos.z - spacing))
  425. elseif i == 4 then
  426. zombeh:moveTo(Vector3.new(pos.x - spacing, pos.y,pos.z - spacing))
  427. elseif i == 5 then
  428. zombeh:moveTo(pos)
  429. end
  430.  
  431. end
  432.  
  433. end
  434.  
  435.  
  436. function onActivated()
  437.  
  438. if not Tool.Enabled then
  439. return
  440. end
  441.  
  442. Tool.GripPos = Vector3.new(0,0.5,0)
  443.  
  444. Tool.Enabled = false
  445.  
  446. local character = Tool.Parent;
  447. local humanoid = character.Humanoid
  448. if humanoid == nil then
  449. print("Humanoid not found")
  450. return
  451. end
  452.  
  453. local targetPos = humanoid.Parent.Torso.Position
  454.  
  455. wait(0.5)
  456. Tool.GripPos = Vector3.new(0,0,0)
  457.  
  458. fire(targetPos, humanoid)
  459. wait(reloadTime)
  460.  
  461. Tool.Enabled = true
  462. end
  463.  
  464. Tool.Activated:connect(onActivated)
  465.  
  466. end))
  467. Script4.Name = "ChaseScript"
  468. Script4.Parent = Tool0
  469. table.insert(cors,sandbox(Script4,function()
  470. wait(3)
  471. zombieParent = false
  472.  
  473. while zombieParent == false do
  474.  
  475. wait(1)
  476. if script.Parent.Name == "SummonedZombie" then
  477. zombieParent = true
  478. end
  479.  
  480. end
  481.  
  482. local larm = script.Parent:FindFirstChild("Left Arm")
  483. local rarm = script.Parent:FindFirstChild("Right Arm")
  484. local waitTimer = 0
  485.  
  486. function findNearestTorso(pos)
  487. local list = game.Workspace:children()
  488. local torso = nil
  489. local dist = 100
  490. local temp = nil
  491. local human = nil
  492. local temp2 = nil
  493. for x = 1, #list do
  494. temp2 = list[x]
  495. if (temp2.className == "Model") and (temp2 ~= script.Parent) and (temp2.Name ~= "SummonedZombie") then
  496. temp = temp2:findFirstChild("Torso")
  497. human = temp2:findFirstChild("Humanoid")
  498. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (human ~= script.Parent.Owner.Value) then
  499. if (temp.Position - pos).magnitude < dist then
  500. torso = temp
  501. dist = (temp.Position - pos).magnitude
  502. end
  503. end
  504. end
  505. end
  506. return torso
  507. end
  508.  
  509. function Hit(hit)
  510. local human = hit.Parent:FindFirstChild("Humanoid")
  511. if human ~= nil and human ~= script.Parent.Owner.Value and waitTimer == 0 and human.Parent.Name ~= "SummonedZombie" then
  512. human:TakeDamage(20)
  513. waitTimer = 3
  514. end
  515. end
  516.  
  517. larm.Touched:connect(Hit)
  518. rarm.Touched:connect(Hit)
  519.  
  520. while true do
  521. wait(1)
  522. local target = findNearestTorso(script.Parent.Torso.Position)
  523. if target ~= nil then
  524. script.Parent.Humanoid:MoveTo(target.Position, target)
  525. end
  526. if waitTimer > 0 then
  527. waitTimer = waitTimer - 1
  528. end
  529. if script.Parent.Humanoid.Health < 1 then
  530. wait(3)
  531. script.Parent:remove()
  532. end
  533. jumper = math.random(1,2)
  534. if jumper == 2 then
  535. script.Parent.Humanoid.Jump = true
  536. end
  537. end
  538.  
  539. end))
  540. Script5.Name = "Robot"
  541. Script5.Parent = Tool0
  542. table.insert(cors,sandbox(Script5,function()
  543. zombieParent = false
  544.  
  545. while zombieParent == false do
  546.  
  547. wait(0.5)
  548. if script.Parent.Name == "SummonedZombie" then
  549. zombieParent = true
  550. end
  551.  
  552. end
  553.  
  554. model = script.Parent
  555. backup = model:Clone()
  556. regentime = 1 --5 minutes
  557.  
  558. ------------------
  559. --SPAWNING--
  560. ------------------
  561. miked=script.Parent
  562.  
  563. itlh=miked.Torso:findFirstChild("Left Hip")
  564. itlh.Part0=miked.Torso
  565. itlh.Part1=miked:findFirstChild("Left Leg")
  566. itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  567.  
  568. itrh=miked.Torso:findFirstChild("Right Hip")
  569. itrh.Part0=miked.Torso
  570. itrh.Part1=miked:findFirstChild("Right Leg")
  571. itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  572.  
  573. itls=miked.Torso:findFirstChild("Left Shoulder")
  574. itls.Part1=miked.Torso
  575. itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  576. itls.Part0=miked:findFirstChild("Left Arm")
  577.  
  578. itrs=miked.Torso:findFirstChild("Right Shoulder")
  579. itrs.Part1=miked.Torso
  580. itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0)
  581. itrs.Part0=miked:findFirstChild("Right Arm")
  582.  
  583. miked.Head:makeJoints()
  584.  
  585. wait(3)
  586. miked:findFirstChild("Left Arm").Anchored = false
  587. miked:findFirstChild("Right Arm").Anchored = false
  588. ------------------
  589. ------------------
  590.  
  591.  
  592. function waitForChild(parent, childName)
  593. while true do
  594. local child = parent:findFirstChild(childName)
  595. if child then
  596. return child
  597. end
  598. parent.ChildAdded:wait()
  599. end
  600. end
  601.  
  602. local Figure = script.Parent
  603. local Torso = waitForChild(Figure, "Torso")
  604. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  605. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  606. local RightHip = waitForChild(Torso, "Right Hip")
  607. local LeftHip = waitForChild(Torso, "Left Hip")
  608. local Neck = waitForChild(Torso, "Neck")
  609. local Humanoid = waitForChild(Figure, "Zombie")
  610. local pose = "Standing"
  611.  
  612. local toolAnim = "None"
  613. local toolAnimTime = 0
  614.  
  615. local isSeated = false
  616.  
  617.  
  618. function onRunning(speed)
  619. if isSeated then return end
  620.  
  621. if speed>0 then
  622. pose = "Running"
  623. else
  624. pose = "Standing"
  625. end
  626. end
  627.  
  628. function onDied()
  629. pose = "Dead"
  630. wait(regentime)
  631. wait(1)
  632. model:remove()
  633. model = backup:Clone()
  634. wait(3)
  635. model.Parent = game.Workspace
  636. model:MakeJoints()
  637. end
  638.  
  639. function onJumping()
  640. isSeated = false
  641. pose = "Jumping"
  642. end
  643.  
  644. function onClimbing()
  645. pose = "Climbing"
  646. end
  647.  
  648. function onGettingUp()
  649. pose = "GettingUp"
  650. end
  651.  
  652. function onFreeFall()
  653. pose = "FreeFall"
  654. end
  655.  
  656. function onDancing()
  657. pose = "Dancing"
  658. end
  659.  
  660. function onFallingDown()
  661. pose = "FallingDown"
  662. end
  663.  
  664. function onSeated()
  665. isSeated = true
  666. pose = "Seated"
  667. end
  668.  
  669.  
  670.  
  671. function moveJump()
  672. RightShoulder.MaxVelocity = 0.5
  673. LeftShoulder.MaxVelocity = 0.5
  674. RightShoulder.DesiredAngle = -3.14
  675. LeftShoulder.DesiredAngle = -3.14
  676. RightHip.DesiredAngle = 0
  677. LeftHip.DesiredAngle = 0
  678. end
  679.  
  680. function moveFreeFall()
  681. RightShoulder.MaxVelocity = 0.5
  682. LeftShoulder.MaxVelocity = 0.5
  683. RightShoulder.DesiredAngle = -1
  684. LeftShoulder.DesiredAngle = -1
  685. RightHip.DesiredAngle = 0
  686. LeftHip.DesiredAngle = 0
  687. end
  688.  
  689. function moveFloat()
  690. RightShoulder.MaxVelocity = 0.5
  691. LeftShoulder.MaxVelocity = 0.5
  692. RightShoulder.DesiredAngle = -1.57
  693. LeftShoulder.DesiredAngle = 1.57
  694. RightHip.DesiredAngle = 1.57
  695. LeftHip.DesiredAngle = -1.57
  696. end
  697.  
  698. function moveBoogy()
  699. while pose=="Boogy" do
  700. wait(.5)
  701. RightShoulder.MaxVelocity = 1
  702. LeftShoulder.MaxVelocity = 1
  703. RightShoulder.DesiredAngle = -3.14
  704. LeftShoulder.DesiredAngle = 0
  705. RightHip.DesiredAngle = 1.57
  706. LeftHip.DesiredAngle = 0
  707. wait(.5)
  708. RightShoulder.MaxVelocity = 1
  709. LeftShoulder.MaxVelocity = 1
  710. RightShoulder.DesiredAngle = 0
  711. LeftShoulder.DesiredAngle = -3.14
  712. RightHip.DesiredAngle = 0
  713. LeftHip.DesiredAngle = 1.57
  714. end
  715. end
  716.  
  717. function moveZombie()
  718. RightShoulder.MaxVelocity = 0.5
  719. LeftShoulder.MaxVelocity = 0.5
  720. RightShoulder.DesiredAngle = -1.57
  721. LeftShoulder.DesiredAngle = 1.57
  722. RightHip.DesiredAngle = 0
  723. LeftHip.DesiredAngle = 0
  724. end
  725.  
  726. function movePunch()
  727. script.Parent.Torso.Anchored=true
  728. RightShoulder.MaxVelocity = 60
  729. LeftShoulder.MaxVelocity = 0.5
  730. RightShoulder.DesiredAngle = -1.57
  731. LeftShoulder.DesiredAngle = 0
  732. RightHip.DesiredAngle = 0
  733. LeftHip.DesiredAngle = 0
  734. wait(1)
  735. script.Parent.Torso.Anchored=false
  736. pose="Standing"
  737.  
  738. end
  739.  
  740. function moveKick()
  741. RightShoulder.MaxVelocity = 0.5
  742. LeftShoulder.MaxVelocity = 0.5
  743. RightShoulder.DesiredAngle = 0
  744. LeftShoulder.DesiredAngle = 0
  745. RightHip.MaxVelocity = 40
  746. RightHip.DesiredAngle = 1.57
  747. LeftHip.DesiredAngle = 0
  748. wait(1)
  749. pose="Standing"
  750.  
  751. end
  752.  
  753. function moveFly()
  754. RightShoulder.MaxVelocity = 0.5
  755. LeftShoulder.MaxVelocity = 0.5
  756. RightShoulder.DesiredAngle = 0
  757. LeftShoulder.DesiredAngle = 0
  758. RightHip.MaxVelocity = 40
  759. RightHip.DesiredAngle = 1.57
  760. LeftHip.DesiredAngle = 0
  761. wait(1)
  762. pose="Standing"
  763.  
  764. end
  765.  
  766.  
  767. function moveClimb()
  768. RightShoulder.MaxVelocity = 0.5
  769. LeftShoulder.MaxVelocity = 0.5
  770. RightShoulder.DesiredAngle = -3.14
  771. LeftShoulder.DesiredAngle = 3.14
  772. RightHip.DesiredAngle = 0
  773. LeftHip.DesiredAngle = 0
  774. end
  775.  
  776. function moveSit()
  777. RightShoulder.MaxVelocity = 0.15
  778. LeftShoulder.MaxVelocity = 0.15
  779. RightShoulder.DesiredAngle = -3.14 /2
  780. LeftShoulder.DesiredAngle = -3.14 /2
  781. RightHip.DesiredAngle = 3.14 /2
  782. LeftHip.DesiredAngle = -3.14 /2
  783. end
  784.  
  785. function getTool()
  786.  
  787. kidTable = Figure:children()
  788. if (kidTable ~= nil) then
  789. numKids = #kidTable
  790. for i=1,numKids do
  791. if (kidTable[i].className == "Tool") then return kidTable[i] end
  792. end
  793. end
  794.  
  795. return nil
  796. end
  797.  
  798. function getToolAnim(tool)
  799.  
  800. c = tool:children()
  801. for i=1,#c do
  802. if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
  803. return c[i]
  804. end
  805. end
  806. return nil
  807. end
  808.  
  809. function animateTool()
  810.  
  811. if (toolAnim == "None") then
  812. RightShoulder.DesiredAngle = -1.57
  813. return
  814. end
  815.  
  816. if (toolAnim == "Slash") then
  817. RightShoulder.MaxVelocity = 0.5
  818. RightShoulder.DesiredAngle = 0
  819. return
  820. end
  821.  
  822. if (toolAnim == "Lunge") then
  823. RightShoulder.MaxVelocity = 0.5
  824. LeftShoulder.MaxVelocity = 0.5
  825. RightHip.MaxVelocity = 0.5
  826. LeftHip.MaxVelocity = 0.5
  827. RightShoulder.DesiredAngle = -1.57
  828. LeftShoulder.DesiredAngle = 1.0
  829. RightHip.DesiredAngle = 1.57
  830. LeftHip.DesiredAngle = 1.0
  831. return
  832. end
  833. end
  834.  
  835. function move(time)
  836. local amplitude
  837. local frequency
  838.  
  839. if (pose == "Jumping") then
  840. moveJump()
  841. return
  842. end
  843.  
  844. if (pose == "Zombie") then
  845. moveZombie()
  846. return
  847. end
  848.  
  849. if (pose == "Boogy") then
  850. moveBoogy()
  851. return
  852. end
  853.  
  854. if (pose == "Float") then
  855. moveFloat()
  856. return
  857. end
  858.  
  859. if (pose == "Punch") then
  860. movePunch()
  861. return
  862. end
  863.  
  864. if (pose == "Kick") then
  865. moveKick()
  866. return
  867. end
  868.  
  869. if (pose == "Fly") then
  870. moveFly()
  871. return
  872. end
  873.  
  874. if (pose == "FreeFall") then
  875. moveFreeFall()
  876. return
  877. end
  878.  
  879. if (pose == "Climbing") then
  880. moveClimb()
  881. return
  882. end
  883.  
  884. if (pose == "Seated") then
  885. moveSit()
  886. return
  887. end
  888.  
  889. amplitude = 0.1
  890. frequency = 1
  891.  
  892. RightShoulder.MaxVelocity = 0.15
  893. LeftShoulder.MaxVelocity = 0.15
  894. if (pose == "Running") then
  895. amplitude = 1
  896. frequency = 9
  897. elseif (pose == "Dancing") then
  898. amplitude = 2
  899. frequency = 16
  900. end
  901.  
  902.  
  903. desiredAngle = amplitude * math.sin(time*frequency)
  904. if pose~="Dancing" then
  905. RightShoulder.DesiredAngle = -desiredAngle
  906. LeftShoulder.DesiredAngle = desiredAngle
  907. RightHip.DesiredAngle = -desiredAngle
  908. LeftHip.DesiredAngle = -desiredAngle
  909. else
  910. RightShoulder.DesiredAngle = desiredAngle
  911. LeftShoulder.DesiredAngle = desiredAngle
  912. RightHip.DesiredAngle = -desiredAngle
  913. LeftHip.DesiredAngle = -desiredAngle
  914. end
  915.  
  916.  
  917.  
  918. local tool = getTool()
  919.  
  920. if tool ~= nil then
  921.  
  922. animStringValueObject = getToolAnim(tool)
  923.  
  924. if animStringValueObject ~= nil then
  925. toolAnim = animStringValueObject.Value
  926. -- message recieved, delete StringValue
  927. animStringValueObject.Parent = nil
  928. toolAnimTime = time + .3
  929. end
  930.  
  931. if time > toolAnimTime then
  932. toolAnimTime = 0
  933. toolAnim = "None"
  934. end
  935.  
  936. animateTool()
  937.  
  938.  
  939. else
  940. toolAnim = "None"
  941. toolAnimTime = 0
  942. end
  943. end
  944.  
  945.  
  946. -- connect events
  947. -----------------------------------------------------------------------------------------------------------------------
  948.  
  949. function unequip()
  950. local items=script.Parent:children()
  951. for i=1, #items do
  952. if items[i].className=="Tool" then items[i]:remove() end
  953. end
  954. end
  955.  
  956. function onChatted(msg, recipient)
  957. msg = string.lower(msg)
  958.  
  959. if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
  960. if string.match(msg, "equip") then
  961. if game.Workspace:findFirstChild("Hub") then
  962. if string.match(msg, "rocket") then unequip()
  963. game.Workspace.Hub.Rocket:clone().Parent=script.Parent
  964. elseif string.match(msg, "slingshot") then unequip()
  965. game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
  966. elseif string.match(msg, "sword") then unequip()
  967. game.Workspace.Hub.Sword:clone().Parent=script.Parent
  968. elseif string.match(msg, "pbg") then unequip()
  969. game.Workspace.Hub.PBG:clone().Parent=script.Parent
  970. elseif string.match(msg, "superball") then unequip()
  971. game.Workspace.Hub.Superball:clone().Parent=script.Parent
  972. elseif string.match(msg, "trowel") then unequip()
  973. game.Workspace.Hub.Trowel:clone().Parent=script.Parent
  974. elseif string.match(msg, "bomb") then unequip()
  975. game.Workspace.Hub.Bomb:clone().Parent=script.Parent
  976. end
  977. end
  978. end
  979. if string.match(msg, "unequip") then unequip() end
  980. if string.match(msg, "run") then onRunning(1) end
  981. if string.match(msg, "climb") then onClimbing() end
  982. if string.match(msg, "jump") then onJumping() end
  983. if string.match(msg, "zombie") then pose="Zombie" end
  984. if string.match(msg, "disco") then pose="Boogy" end
  985. if string.match(msg, "float") then pose="Float" end
  986. if string.match(msg, "punch") then pose="Punch" end
  987. if string.match(msg, "kick") then pose="Kick" end
  988. if string.match(msg, "fly") then pose="Fly" end
  989. if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
  990. if string.match(msg, "defend") then defence() end
  991. if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
  992. if string.match(msg, "go home") then following=false; gohome() end
  993. if string.match(msg, "follow") then
  994. if string.match(msg, "all") then
  995. followany()
  996. else
  997. local egg=game.Players:children()
  998. for i=1, #egg do
  999. if string.match(msg, string.lower(egg[i].Name)) then
  1000. follow(egg[i].Name)
  1001. return
  1002. end
  1003. end
  1004. end
  1005. end
  1006. if string.match(msg, "kill") then
  1007. if string.match(msg, "all") then
  1008. attackany()
  1009. else
  1010. local egg=game.Players:children()
  1011. for i=1, #egg do
  1012. if string.match(msg, string.lower(egg[i].Name)) then
  1013. attack(egg[i].Name)
  1014. return
  1015. end
  1016. end
  1017. end
  1018. end
  1019.  
  1020. end
  1021. end
  1022.  
  1023. if game.Players.NumPlayers>1 then
  1024. x=game.Players:children()
  1025.  
  1026. for i=1, #x do
  1027. if script.Parent:findFirstChild("Commander")~=nil then
  1028. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  1029. local ch=script.Parent.Commander:children()
  1030. for i=1, #ch do
  1031. if string.lower(ch[i].Name)==string.lower(x[i].Name) then
  1032. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1033. end
  1034. end
  1035. elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
  1036. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1037. end
  1038. else
  1039. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1040. end
  1041. end
  1042. end
  1043.  
  1044.  
  1045. function onPlayerEntered(Player)
  1046. while Player.Name==nil do
  1047. wait(2)
  1048. end
  1049. if script.Parent:findFirstChild("Commander")~=nil then
  1050. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  1051. local ch=script.Parent.Commander:children()
  1052. for i=1, #ch do
  1053. if string.lower(ch[i].Name)==string.lower(Player.Name) then
  1054. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1055. end
  1056. end
  1057. elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
  1058. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1059. end
  1060. else
  1061. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  1062. end
  1063. end
  1064.  
  1065. game.Players.ChildAdded:connect(onPlayerEntered)
  1066.  
  1067.  
  1068.  
  1069. -----------------------------------------------------------------------------------------------------------------------
  1070. -----------------------------------------------------------------------------------------------------------------------
  1071. -----------------------------------------------------------------------------------------------------------------------
  1072. -----------------------------------------------------------------------------------------------------------------------
  1073. -----------------------------------------------------------------------------------------------------------------------
  1074. -----------------------------------------------------------------------------------------------------------------------
  1075. -----------------------------------------------------------------------------------------------------------------------
  1076. -----------------------------------------------------------------------------------------------------------------------
  1077. -----------------------------------------------------------------------------------------------------------------------
  1078. -----------------------------------------------------------------------------------------------------------------------
  1079. -----------------------------------------------------------------------------------------------------------------------
  1080. -----------------------------------------------------------------------------------------------------------------------
  1081. dist=20
  1082.  
  1083. function followany()
  1084. following=true
  1085. while following==true do
  1086.  
  1087. local ch=game.Players:children()
  1088. for i=1, #ch do
  1089. local l=game.Workspace:findFirstChild(ch[i].Name)
  1090. if l~=nil then
  1091. local s=l.Torso
  1092. local p=l.Torso.Position
  1093. local q=script.Parent.Torso.Position
  1094. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  1095. if smallest==nil then
  1096. smallest=d
  1097. target=s
  1098. elseif d<smallest then
  1099. smallest=d
  1100. target=s
  1101. end
  1102. end
  1103. end
  1104.  
  1105. if smallest==nil then stopmoving() return end
  1106.  
  1107. if smallest>6*dist then return end
  1108.  
  1109. script.Parent.Humanoid:MoveTo(target.Position, target)
  1110.  
  1111. wait(0.5)
  1112. for i=1, 6 do
  1113. if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
  1114. end
  1115. end
  1116. end
  1117.  
  1118.  
  1119.  
  1120. function gohome()
  1121. script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
  1122. end
  1123. function stopmoving()
  1124. script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
  1125. end
  1126.  
  1127. function follow(name)
  1128. following=true
  1129.  
  1130. local p=game.Workspace:findFirstChild(name)
  1131. if p==nil then return end
  1132. while following==true do
  1133. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  1134. wait(0.5)
  1135. for i=1, 3 do
  1136. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  1137. wait(0.5)
  1138. end
  1139. end
  1140. end
  1141.  
  1142. function attack(name)
  1143. if script.Parent:findFirstChild("Sword")~=nil then
  1144. following=true
  1145. local p=game.Workspace:findFirstChild(name)
  1146. if p==nil then return end
  1147. while following==true do
  1148. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  1149. wait(0.5)
  1150. for i=1, 3 do
  1151. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  1152. local l=p.Torso.Position
  1153. local q=script.Parent.Torso.Position
  1154. local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
  1155. if d<10 then
  1156. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
  1157. if (q.y-l.y)>3 and (q.y-l.y)<7 then
  1158. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  1159. end
  1160. end
  1161. wait(1)
  1162. end
  1163. end
  1164. end
  1165. end
  1166.  
  1167. function attackany()
  1168. if script.Parent:findFirstChild("Sword")~=nil then
  1169.  
  1170. following=true
  1171. while following==true do
  1172.  
  1173. local ch=game.Players:children()
  1174. for i=1, #ch do
  1175. local l=game.Workspace:findFirstChild(ch[i].Name)
  1176. if l~=nil then
  1177. local s=l.Torso
  1178. local p=l.Torso.Position
  1179. local q=script.Parent.Torso.Position
  1180. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  1181. if smallest==nil then
  1182. smallest=d
  1183. target=s
  1184. elseif d<smallest then
  1185. smallest=d
  1186. target=s
  1187. end
  1188. end
  1189. end
  1190.  
  1191. if smallest==nil then stopmoving() return end
  1192.  
  1193. if smallest>6*dist then return end
  1194.  
  1195. script.Parent.Humanoid:MoveTo(target.Position, target)
  1196.  
  1197. if smallest<10 then
  1198. slash()
  1199. end
  1200. if target.Parent==nil then stopmoving() return end
  1201. wait(0.5)
  1202. for i=1, 3 do
  1203. if target.Parent.Humanoid.Health<1 then
  1204. stopmoving()
  1205. else
  1206. local p=target.Position
  1207. local q=script.Parent.Torso.Position
  1208. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  1209. if d<10 then
  1210. script.Parent.Humanoid:MoveTo(target.Position, target); slash()
  1211. if (q.y-p.y)>3 and (q.y-p.y)<7 then
  1212. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  1213. end
  1214. end
  1215. wait(1)
  1216. end
  1217. end
  1218. end
  1219. end
  1220. end
  1221.  
  1222.  
  1223. function patrol()
  1224. if points==nil then
  1225. points=0
  1226. if game.Workspace:findFirstChild("pp1")~=nil then
  1227. pp1=game.Workspace:findFirstChild("pp1")
  1228. local points=points+1
  1229. if game.Workspace:findFirstChild("pp2")~=nil then
  1230. pp2=game.Workspace:findFirstChild("pp2")
  1231. local points=points+1
  1232. if game.Workspace:findFirstChild("pp3")~=nil then
  1233. pp3=game.Workspace:findFirstChild("pp3")
  1234. local points=points+1
  1235. if game.Workspace:findFirstChild("pp4")~=nil then
  1236. pp4=game.Workspace:findFirstChild("pp4")
  1237. local points=points+1
  1238. if game.Workspace:findFirstChild("pp5")~=nil then
  1239. pp5=game.Workspace:findFirstChild("pp5")
  1240. local points=points+1
  1241. if game.Workspace:findFirstChild("pp6")~=nil then
  1242. pp6=game.Workspace:findFirstChild("pp6")
  1243. local points=points+1
  1244. if game.Workspace:findFirstChild("pp7")~=nil then
  1245. pp7=game.Workspace:findFirstChild("pp7")
  1246. local points=points+1
  1247. if game.Workspace:findFirstChild("pp8")~=nil then
  1248. pp8=game.Workspace:findFirstChild("pp8")
  1249. local points=points+1
  1250. if game.Workspace:findFirstChild("pp9")~=nil then
  1251. pp9=game.Workspace:findFirstChild("pp9")
  1252. local points=points+1
  1253. end
  1254. end
  1255. end
  1256. end
  1257. end
  1258. end
  1259. end
  1260. end
  1261. end
  1262. end
  1263.  
  1264. if points<1 then return end
  1265. patrolling=true
  1266. local time=2
  1267. if points==1 then return end
  1268. if points>1 then
  1269. while patrolling==true do
  1270. script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
  1271. wait(time)
  1272. script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
  1273. wait(time)
  1274. if points>2 then
  1275. script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
  1276. wait(time)
  1277. if points>3 then
  1278. script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
  1279. wait(time)
  1280. if points>4 then
  1281. script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
  1282. wait(time)
  1283. if points>5 then
  1284. script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
  1285. wait(time)
  1286. if points>6 then
  1287. script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
  1288. wait(time)
  1289. if points>7 then
  1290. script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
  1291. wait(time)
  1292. if points>8 then
  1293. script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
  1294. wait(time)
  1295. end
  1296. end
  1297. end
  1298. end
  1299. end
  1300. end
  1301. end
  1302. end
  1303. end
  1304. end
  1305.  
  1306.  
  1307. function goto(pos,part)
  1308. while true do
  1309. end
  1310. end
  1311.  
  1312.  
  1313. function slash()
  1314. for i=1, 3 do
  1315. wait(.3)
  1316. RightShoulder.MaxVelocity = 2
  1317. LeftShoulder.MaxVelocity = 1
  1318. RightShoulder.DesiredAngle = -2.14
  1319. LeftShoulder.DesiredAngle = 0
  1320. RightHip.DesiredAngle = 0
  1321. LeftHip.DesiredAngle = 0
  1322. wait(.2)
  1323. RightShoulder.MaxVelocity = 2
  1324. LeftShoulder.MaxVelocity = 1
  1325. RightShoulder.DesiredAngle = 0
  1326. LeftShoulder.DesiredAngle = 0
  1327. RightHip.DesiredAngle = 0
  1328. LeftHip.DesiredAngle = 0
  1329. end
  1330. end
  1331.  
  1332. function defence()
  1333. proxkill=true
  1334. while proxkill==true do
  1335. local ch=game.Players:children()
  1336. for i=1, #ch do
  1337. local p=game.Workspace:findFirstChild(ch[i].Name)
  1338. if p~=nil then
  1339. local p=p.Torso.Position
  1340. local q=script.Parent.Torso.Position
  1341. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  1342. if d<dist and d>8 then
  1343. local ex=Instance.new("Explosion")
  1344. ex.Position=p
  1345. ex.Parent=game.Workspace
  1346. end
  1347. end
  1348. end
  1349. wait(1)
  1350. end
  1351. end
  1352.  
  1353.  
  1354.  
  1355.  
  1356. -----------------------------------------------------------------------------------------------------------------------
  1357. -----------------------------------------------------------------------------------------------------------------------
  1358. -----------------------------------------------------------------------------------------------------------------------
  1359. -----------------------------------------------------------------------------------------------------------------------
  1360. -----------------------------------------------------------------------------------------------------------------------
  1361. -----------------------------------------------------------------------------------------------------------------------
  1362. -----------------------------------------------------------------------------------------------------------------------
  1363. -----------------------------------------------------------------------------------------------------------------------
  1364. -----------------------------------------------------------------------------------------------------------------------
  1365. -----------------------------------------------------------------------------------------------------------------------
  1366. -----------------------------------------------------------------------------------------------------------------------
  1367. -----------------------------------------------------------------------------------------------------------------------
  1368.  
  1369.  
  1370. Humanoid.Died:connect(onDied)
  1371. Humanoid.Running:connect(onRunning)
  1372. Humanoid.Jumping:connect(onJumping)
  1373. Humanoid.Climbing:connect(onClimbing)
  1374. Humanoid.GettingUp:connect(onGettingUp)
  1375. Humanoid.FreeFalling:connect(onFreeFall)
  1376. Humanoid.FallingDown:connect(onFallingDown)
  1377. Humanoid.Seated:connect(onSeated)
  1378.  
  1379.  
  1380. --[[
  1381.  
  1382. function newSound(id)
  1383. local sound = Instance.new("Sound")
  1384. sound.SoundId = id
  1385. sound.Parent = script.Parent.Head
  1386. return sound
  1387. end
  1388.  
  1389.  
  1390. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  1391. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  1392. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  1393. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  1394. local sJumping = newSound("rbxasset://sounds/button.wav")
  1395. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  1396. sRunning.Looped = true
  1397.  
  1398. local Figure = script.Parent
  1399. local Head = waitForChild(Figure, "Head")
  1400. local Humanoid = waitForChild(Figure, "Humanoid")
  1401.  
  1402.  
  1403. function onDied()
  1404. sDied:play()
  1405. end
  1406.  
  1407. function onState(state, sound)
  1408. if state then
  1409. sound:play()
  1410. else
  1411. sound:pause()
  1412. end
  1413. end
  1414.  
  1415. function onRunning(speed)
  1416. if speed>0 then
  1417. sRunning:play()
  1418. else
  1419. sRunning:pause()
  1420. end
  1421. end
  1422.  
  1423.  
  1424. Humanoid.Died:connect(onDied)
  1425. Humanoid.Running:connect(onRunning)
  1426. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  1427. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  1428. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  1429. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  1430. --]]
  1431.  
  1432. local nextTime = 0
  1433. local runService = game:service("RunService");
  1434.  
  1435. while Figure.Parent~=nil do
  1436. time = runService.Stepped:wait()
  1437. if time > nextTime then
  1438. move(time)
  1439. nextTime = time + 0.1
  1440. end
  1441. end
  1442.  
  1443. end))
  1444. Script6.Name = "PlaySounds"
  1445. Script6.Parent = Tool0
  1446. table.insert(cors,sandbox(Script6,function()
  1447. zombieParent = false
  1448.  
  1449. local soundIds = {25954372, 25954392, 25954407}
  1450. local sounds = {}
  1451. for i=1,#soundIds do
  1452. local s = Instance.new("Sound")
  1453. s.SoundId = "http://www.roblox.com/asset/?id=" .. soundIds[i]
  1454. s.Volume = 1
  1455. s.Parent = script.Parent
  1456. sounds[#sounds + 1] = s
  1457. end
  1458.  
  1459. while zombieParent == false do
  1460.  
  1461. wait(1)
  1462. if script.Parent.Name == "Head" then
  1463. zombieParent = true
  1464. end
  1465.  
  1466. end
  1467.  
  1468. while true do
  1469. wait(math.random(5,10))
  1470. local i = math.random(1, #sounds)
  1471. sounds[i].Pitch = .8 + (math.random() * .2)
  1472. sounds[i]:Play()
  1473. end
  1474. end))
  1475. Script7.Name = "Timer"
  1476. Script7.Parent = Tool0
  1477. table.insert(cors,sandbox(Script7,function()
  1478. zombieParent = false
  1479.  
  1480. while zombieParent == false do
  1481.  
  1482. wait(1)
  1483. if script.Parent.Name == "SummonedZombie" then
  1484. zombieParent = true
  1485. end
  1486.  
  1487. end
  1488.  
  1489. wait(30)
  1490. script.Parent:remove()
  1491. end))
  1492. Script8.Name = "WeldScript"
  1493. Script8.Parent = Tool0
  1494. table.insert(cors,sandbox(Script8,function()
  1495. zombieParent = false
  1496.  
  1497. while zombieParent == false do
  1498.  
  1499. wait(1)
  1500. if script.Parent.Name == "SummonedZombie" then
  1501. zombieParent = true
  1502. end
  1503.  
  1504. end
  1505.  
  1506.  
  1507. local p=script.Parent:GetChildren()
  1508. for i=1,#p do
  1509. if p[i].className=="Part" then
  1510.  
  1511. local weld = Instance.new("Weld")
  1512. weld.Name="Hold"
  1513. weld.Part0 = p[i]
  1514. weld.Part1 = script.Parent.Parent.Torso
  1515.  
  1516. local HitPos = p[i].Position + (p[i].CFrame.lookVector * .5)
  1517.  
  1518. local CJ = CFrame.new(HitPos)
  1519. local C0 = p[i].CFrame:inverse() *CJ
  1520. local C1 = script.Parent.Parent.Torso.CFrame:inverse() * CJ
  1521.  
  1522. weld.C0 = C0
  1523. weld.C1 = C1
  1524.  
  1525. weld.Parent = p[i]
  1526. end
  1527. end
  1528. end))
  1529. Sound9.Parent = Tool0
  1530. Sound9.SoundId = "http://www.roblox.com/asset/?id=25954372"
  1531. Sound9.Volume = 1
  1532. Sound10.Parent = Tool0
  1533. Sound10.SoundId = "http://www.roblox.com/asset/?id=25954392"
  1534. Sound10.Volume = 1
  1535. Sound11.Parent = Tool0
  1536. Sound11.SoundId = "http://www.roblox.com/asset/?id=25954407"
  1537. Sound11.Volume = 1
  1538. for i,v in pairs(mas:GetChildren()) do
  1539. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1540. pcall(function() v:MakeJoints() end)
  1541. end
  1542. mas:Destroy()
  1543. for i,v in pairs(cors) do
  1544. spawn(function()
  1545. pcall(v)
  1546. end)
  1547. end
  1548.  
  1549. while true do
  1550. duck.TextureId = 'rbxassetid://1719079844'
  1551. wait (3)
  1552. duck.TextureId = 'rbxassetid://4363442248'
  1553. wait (0.2)
  1554. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement