Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.84 KB | None | 0 0
  1. IT = Instance.new
  2. CF = CFrame.new
  3. VT = Vector3.new
  4. RAD = math.rad
  5. C3 = Color3.new
  6. UD2 = UDim2.new
  7. BRICKC = BrickColor.new
  8. ANGLES = CFrame.Angles
  9. EULER = CFrame.fromEulerAnglesXYZ
  10. COS = math.cos
  11. ACOS = math.acos
  12. SIN = math.sin
  13. ASIN = math.asin
  14. ABS = math.abs
  15. MRANDOM = math.random
  16. FLOOR = math.floor
  17.  
  18.  
  19. Pscale = 1.625
  20.  
  21.  
  22. local CHARACTER = script.Parent
  23. local CLONE = CHARACTER:Clone()
  24. local TORSO = CHARACTER.HumanoidRootPart
  25. local HED = CHARACTER.Head
  26. local HUMANOID = CHARACTER.Humanoid
  27. local CLASSIFICATION = CHARACTER.Classification.Value
  28. local ANIMS = script.Anims
  29. local ARMS = HUMANOID:LoadAnimation(ANIMS.ArmAnim)
  30. local ATTACKA = HUMANOID:LoadAnimation(ANIMS.Attack)
  31. local Minion=CHARACTER:WaitForChild("Furry"):Clone()
  32. CHARACTER.Furry:Destroy()
  33. local DEAD = false
  34. local Attack = false
  35. local TweenService = game:GetService("TweenService")
  36. RootPart = CHARACTER["HumanoidRootPart"]
  37. Torso = CHARACTER["Torso"]
  38. Head = CHARACTER["Head"]
  39. RightArm = CHARACTER["Right Arm"]
  40. LeftArm = CHARACTER["Left Arm"]
  41. RightLeg = CHARACTER["Right Leg"]
  42. LeftLeg = CHARACTER["Left Leg"]
  43. RootJoint = RootPart["RootJoint"]
  44. Neck = Torso["Neck"]
  45. RS =Torso["Right Shoulder"]
  46. LS =Torso["Left Shoulder"]
  47. RH =Torso["Right Hip"]
  48. LH =Torso["Left Hip"]
  49. local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  50. local NeckCF = CF(0, 1*Pscale, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  51. RS.C1 = CF(0, 0.5*Pscale, 0)
  52. LS.C1 = CF(0, 0.5*Pscale, 0)
  53. RH.C1 = CF(0, 1*Pscale, 0) *CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
  54. LH.C1 = CF(0, 1*Pscale, 0) *CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
  55. AnimP = 0
  56. AnimSpeed=0
  57. Anim = "Walk"
  58. local Tuant = Head:WaitForChild("Tuant")
  59. local Effects = IT("Folder",CHARACTER)
  60. Debris = game:GetService("Debris")
  61.  
  62.  
  63. music = CHARACTER.Sound
  64.  
  65.  
  66. --//=================================\\
  67. --|| SAZERENOS' ARTIFICIAL HEARTBEAT
  68. --\\=================================//
  69.  
  70. ArtificialHB = Instance.new("BindableEvent", script)
  71. ArtificialHB.Name = "ArtificialHB"
  72.  
  73. script:WaitForChild("ArtificialHB")
  74.  
  75. frame = 1/60
  76. tf = 0
  77. allowframeloss = false
  78. tossremainder = false
  79. lastframe = tick()
  80. script.ArtificialHB:Fire()
  81.  
  82. game:GetService("RunService").Heartbeat:connect(function(s, p)
  83. tf = tf + s
  84. if tf >= frame then
  85. if allowframeloss then
  86. script.ArtificialHB:Fire()
  87. lastframe = tick()
  88. else
  89. for i = 1, math.floor(tf / frame) do
  90. script.ArtificialHB:Fire()
  91. end
  92. lastframe = tick()
  93. end
  94. if tossremainder then
  95. tf = 0
  96. else
  97. tf = tf - frame * math.floor(tf / frame)
  98. end
  99. end
  100. end)
  101.  
  102. function PositiveAngle(NUMBER)
  103. if NUMBER >= 0 then
  104. NUMBER = 0
  105. end
  106. return NUMBER
  107. end
  108.  
  109. function NegativeAngle(NUMBER)
  110. if NUMBER <= 0 then
  111. NUMBER = 0
  112. end
  113. return NUMBER
  114. end
  115.  
  116. function Swait(NUMBER)
  117. if NUMBER == 0 or NUMBER == nil then
  118. ArtificialHB.Event:wait()
  119. else
  120. for i = 1, NUMBER do
  121. ArtificialHB.Event:wait()
  122. end
  123. end
  124. end
  125.  
  126. --//=================================\\
  127. --|| FUNCTIONS
  128. --\\=================================//
  129. function CF2(X1,Y1,Z1)
  130.  
  131. local output = CFrame.new(X1*Pscale,Y1*Pscale,Z1*Pscale)
  132. return output
  133. end
  134. function SetTween(SPart,CFr,MoveStyle2,outorin2,AnimTime)
  135. local MoveStyle = Enum.EasingStyle[MoveStyle2]
  136. local outorin = Enum.EasingDirection[outorin2]
  137.  
  138.  
  139.  
  140.  
  141. local tweeningInformation = TweenInfo.new(
  142. AnimTime,
  143. MoveStyle,
  144. outorin,
  145. 0,
  146. false,
  147. 0
  148. )
  149. local MoveCF = CFr
  150. local tweenanim = TweenService:Create(SPart,tweeningInformation,MoveCF)
  151. tweenanim:Play()
  152. end
  153. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  154. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(5),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  155. --Arms
  156. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(2))},"Quad","InOut",AnimSpeed)
  157. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(-2))},"Quad","InOut",AnimSpeed)
  158.  
  159. --Legs
  160. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  161. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  162.  
  163. function QuaternionFromCFrame(cf)
  164. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  165. local trace = m00 + m11 + m22
  166. if trace > 0 then
  167. local s = math.sqrt(1 + trace)
  168. local recip = 0.5 / s
  169. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  170. else
  171. local i = 0
  172. if m11 > m00 then
  173. i = 1
  174. end
  175. if m22 > (i == 0 and m00 or m11) then
  176. i = 2
  177. end
  178. if i == 0 then
  179. local s = math.sqrt(m00 - m11 - m22 + 1)
  180. local recip = 0.5 / s
  181. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  182. elseif i == 1 then
  183. local s = math.sqrt(m11 - m22 - m00 + 1)
  184. local recip = 0.5 / s
  185. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  186. elseif i == 2 then
  187. local s = math.sqrt(m22 - m00 - m11 + 1)
  188. local recip = 0.5 / s return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  189. end
  190. end
  191. end
  192.  
  193. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  194. local xs, ys, zs = x + x, y + y, z + z
  195. local wx, wy, wz = w * xs, w * ys, w * zs
  196. local xx = x * xs
  197. local xy = x * ys
  198. local xz = x * zs
  199. local yy = y * ys
  200. local yz = y * zs
  201. local zz = z * zs
  202. return CFrame.new(px, py, pz, 1 - (yy + zz), xy - wz, xz + wy, xy + wz, 1 - (xx + zz), yz - wx, xz - wy, yz + wx, 1 - (xx + yy))
  203. end
  204.  
  205. function QuaternionSlerp(a, b, t)
  206. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  207. local startInterp, finishInterp;
  208. if cosTheta >= 0.0001 then
  209. if (1 - cosTheta) > 0.0001 then
  210. local theta = ACOS(cosTheta)
  211. local invSinTheta = 1 / SIN(theta)
  212. startInterp = SIN((1 - t) * theta) * invSinTheta
  213. finishInterp = SIN(t * theta) * invSinTheta
  214. else
  215. startInterp = 1 - t
  216. finishInterp = t
  217. end
  218. else
  219. if (1 + cosTheta) > 0.0001 then
  220. local theta = ACOS(-cosTheta)
  221. local invSinTheta = 1 / SIN(theta)
  222. startInterp = SIN((t - 1) * theta) * invSinTheta
  223. finishInterp = SIN(t * theta) * invSinTheta
  224. else
  225. startInterp = t - 1
  226. finishInterp = t
  227. end
  228. end
  229. return a[1] * startInterp + b[1] * finishInterp, a[2] * startInterp + b[2] * finishInterp, a[3] * startInterp + b[3] * finishInterp, a[4] * startInterp + b[4] * finishInterp
  230. end
  231.  
  232.  
  233. function CreateMesh(MESH, PARENT, MESHTYPE, MESHID, TEXTUREID, SCALE, OFFSET)
  234. local NEWMESH = IT(MESH)
  235. if MESH == "SpecialMesh" then
  236. NEWMESH.MeshType = MESHTYPE
  237. if MESHID ~= "nil" and MESHID ~= "" then
  238. NEWMESH.MeshId = "http://www.roblox.com/asset/?id="..MESHID
  239. end
  240. if TEXTUREID ~= "nil" and TEXTUREID ~= "" then
  241. NEWMESH.TextureId = "http://www.roblox.com/asset/?id="..TEXTUREID
  242. end
  243. end
  244. NEWMESH.Offset = OFFSET or VT(0, 0, 0)
  245. NEWMESH.Scale = SCALE
  246. NEWMESH.Parent = PARENT
  247. return NEWMESH
  248. end
  249.  
  250. function CreatePart(FORMFACTOR, PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
  251. local NEWPART = IT("Part")
  252. NEWPART.formFactor = FORMFACTOR
  253. NEWPART.Reflectance = REFLECTANCE
  254. NEWPART.Transparency = TRANSPARENCY
  255. NEWPART.CanCollide = false
  256. NEWPART.Locked = true
  257. NEWPART.Anchored = true
  258. if ANCHOR == false then
  259. NEWPART.Anchored = false
  260. end
  261. NEWPART.BrickColor = BRICKC(tostring(BRICKCOLOR))
  262. NEWPART.Name = NAME
  263. NEWPART.Size = SIZE
  264. NEWPART.Position = Torso.Position
  265. NEWPART.Material = MATERIAL
  266. NEWPART:BreakJoints()
  267. NEWPART.Parent = PARENT
  268. return NEWPART
  269. end
  270.  
  271.  
  272.  
  273. function CreateSound(ID, PARENT, VOLUME, PITCH, DOESLOOP)
  274. local NEWSOUND = nil
  275. coroutine.resume(coroutine.create(function()
  276. NEWSOUND = IT("Sound")
  277. NEWSOUND.Parent = PARENT
  278. NEWSOUND.Volume = VOLUME
  279. NEWSOUND.Pitch = PITCH
  280. NEWSOUND.SoundId = "http://www.roblox.com/asset/?id="..ID
  281. NEWSOUND:play()
  282. if DOESLOOP == true then
  283. NEWSOUND.Looped = true
  284. else
  285. repeat wait(1) until NEWSOUND.Playing == false
  286. NEWSOUND:remove()
  287. end
  288. end))
  289. return NEWSOUND
  290. end
  291.  
  292. function WACKYEFFECT(Table)
  293. local TYPE = (Table.EffectType or "Sphere")
  294. local SIZE = (Table.Size or VT(1,1,1))
  295. local ENDSIZE = (Table.Size2 or VT(0,0,0))
  296. local TRANSPARENCY = (Table.Transparency or 0)
  297. local ENDTRANSPARENCY = (Table.Transparency2 or 1)
  298. local CFRAME = (Table.CFrame or Torso.CFrame)
  299. local MOVEDIRECTION = (Table.MoveToPos or nil)
  300. local ROTATION1 = (Table.RotationX or 0)
  301. local ROTATION2 = (Table.RotationY or 0)
  302. local ROTATION3 = (Table.RotationZ or 0)
  303. local MATERIAL = (Table.Material or "Neon")
  304. local COLOR = (Table.Color or C3(1,1,1))
  305. local TIME = (Table.Time or 45)
  306. local SOUNDID = (Table.SoundID or nil)
  307. local SOUNDPITCH = (Table.SoundPitch or nil)
  308. local SOUNDVOLUME = (Table.SoundVolume or nil)
  309. local USEBOOMERANGMATH = (Table.UseBoomerangMath or false)
  310. local BOOMERANG = (Table.Boomerang or 0)
  311. local SIZEBOOMERANG = (Table.SizeBoomerang or 0)
  312. coroutine.resume(coroutine.create(function()
  313. local PLAYSSOUND = false
  314. local SOUND = nil
  315. local EFFECT = CreatePart(3, Effects, MATERIAL, 0, TRANSPARENCY, BRICKC("Pearl"), "Effect", VT(1,1,1), true)
  316. if SOUNDID ~= nil and SOUNDPITCH ~= nil and SOUNDVOLUME ~= nil then
  317. PLAYSSOUND = true
  318. SOUND = CreateSound(SOUNDID, EFFECT, SOUNDVOLUME, SOUNDPITCH, false)
  319. end
  320. EFFECT.Color = COLOR
  321. local MSH = nil
  322. if TYPE == "Sphere" then
  323. MSH = CreateMesh("SpecialMesh", EFFECT, "Sphere", "", "", SIZE, VT(0,0,0))
  324. elseif TYPE == "Block" or TYPE == "Box" then
  325. MSH = IT("BlockMesh",EFFECT)
  326. MSH.Scale = SIZE
  327. elseif TYPE == "Wave" then
  328. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "20329976", "", SIZE, VT(0,0,-SIZE.X/8))
  329. elseif TYPE == "Ring" then
  330. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "559831844", "", VT(SIZE.X,SIZE.X,0.1), VT(0,0,0))
  331. elseif TYPE == "Slash" then
  332. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "662586858", "", VT(SIZE.X/10,0,SIZE.X/10), VT(0,0,0))
  333. elseif TYPE == "Round Slash" then
  334. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "662585058", "", VT(SIZE.X/10,0,SIZE.X/10), VT(0,0,0))
  335. elseif TYPE == "Swirl" then
  336. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "168892432", "", SIZE, VT(0,0,0))
  337. elseif TYPE == "Skull" then
  338. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "4770583", "", SIZE, VT(0,0,0))
  339. elseif TYPE == "Crystal" then
  340. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "9756362", "", SIZE, VT(0,0,0))
  341. end
  342. if MSH ~= nil then
  343. local BOOMR1 = 1+BOOMERANG/50
  344. local BOOMR2 = 1+SIZEBOOMERANG/50
  345. local MOVESPEED = nil
  346. if MOVEDIRECTION ~= nil then
  347. if USEBOOMERANGMATH == true then
  348. MOVESPEED = ((CFRAME.p - MOVEDIRECTION).Magnitude/TIME)*BOOMR1
  349. else
  350. MOVESPEED = ((CFRAME.p - MOVEDIRECTION).Magnitude/TIME)
  351. end
  352. end
  353. local GROWTH = nil
  354. if USEBOOMERANGMATH == true then
  355. GROWTH = (SIZE - ENDSIZE)*(BOOMR2+1)
  356. else
  357. GROWTH = (SIZE - ENDSIZE)
  358. end
  359. local TRANS = TRANSPARENCY - ENDTRANSPARENCY
  360. if TYPE == "Block" then
  361. EFFECT.CFrame = CFRAME*ANGLES(RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)))
  362. else
  363. EFFECT.CFrame = CFRAME
  364. end
  365. if USEBOOMERANGMATH == true then
  366. for LOOP = 1, TIME+1 do
  367. Swait()
  368. MSH.Scale = MSH.Scale - (VT((GROWTH.X)*((1 - (LOOP/TIME)*BOOMR2)),(GROWTH.Y)*((1 - (LOOP/TIME)*BOOMR2)),(GROWTH.Z)*((1 - (LOOP/TIME)*BOOMR2)))*BOOMR2)/TIME
  369. if TYPE == "Wave" then
  370. MSH.Offset = VT(0,0,-MSH.Scale.Z/8)
  371. end
  372. EFFECT.Transparency = EFFECT.Transparency - TRANS/TIME
  373. if TYPE == "Block" then
  374. EFFECT.CFrame = CFRAME*ANGLES(RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)))
  375. else
  376. EFFECT.CFrame = EFFECT.CFrame*ANGLES(RAD(ROTATION1),RAD(ROTATION2),RAD(ROTATION3))
  377. end
  378. if MOVEDIRECTION ~= nil then
  379. local ORI = EFFECT.Orientation
  380. EFFECT.CFrame = CF(EFFECT.Position,MOVEDIRECTION)*CF(0,0,-(MOVESPEED)*((1 - (LOOP/TIME)*BOOMR1)))
  381. EFFECT.Orientation = ORI
  382. end
  383. end
  384. else
  385. for LOOP = 1, TIME+1 do
  386. Swait()
  387. MSH.Scale = MSH.Scale - GROWTH/TIME
  388. if TYPE == "Wave" then
  389. MSH.Offset = VT(0,0,-MSH.Scale.Z/8)
  390. end
  391. EFFECT.Transparency = EFFECT.Transparency - TRANS/TIME
  392. if TYPE == "Block" then
  393. EFFECT.CFrame = CFRAME*ANGLES(RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)))
  394. else
  395. EFFECT.CFrame = EFFECT.CFrame*ANGLES(RAD(ROTATION1),RAD(ROTATION2),RAD(ROTATION3))
  396. end
  397. if MOVEDIRECTION ~= nil then
  398. local ORI = EFFECT.Orientation
  399. EFFECT.CFrame = CF(EFFECT.Position,MOVEDIRECTION)*CF(0,0,-MOVESPEED)
  400. EFFECT.Orientation = ORI
  401. end
  402. end
  403. end
  404. EFFECT.Transparency = 1
  405. if PLAYSSOUND == false then
  406. EFFECT:remove()
  407. else
  408. repeat Swait() until EFFECT:FindFirstChildOfClass("Sound") == nil
  409. EFFECT:remove()
  410. end
  411. else
  412. if PLAYSSOUND == false then
  413. EFFECT:remove()
  414. else
  415. repeat Swait() until EFFECT:FindFirstChildOfClass("Sound") == nil
  416. EFFECT:remove()
  417. end
  418. end
  419. end))
  420. end
  421.  
  422.  
  423.  
  424. wait()
  425.  
  426. function Clerp(a, b, t)
  427. local qa = {QuaternionFromCFrame(a)}
  428. local qb = {QuaternionFromCFrame(b)}
  429. local ax, ay, az = a.x, a.y, a.z
  430. local bx, by, bz = b.x, b.y, b.z
  431. local _t = 1 - t
  432. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  433. end
  434. function GatherAllInstances(Parent,ig)
  435. local Instances = {}
  436. local Ignore=nil
  437. if ig ~= nil then
  438. Ignore = ig
  439. end
  440.  
  441. local function GatherInstances(Parent,Ignore)
  442. for i, v in pairs(Parent:GetChildren()) do
  443.  
  444. if v ~= Ignore then
  445. GatherInstances(v,Ignore)
  446. table.insert(Instances, v) end
  447. end
  448. end
  449. GatherInstances(Parent,Ignore)
  450. return Instances
  451. end
  452.  
  453. function infect(Char)
  454. Char.Archivable=true
  455. local Cloneed=Char:Clone()
  456. local RealPar = Char.Parent
  457.  
  458. --Char.Parent = nil
  459. Char:BreakJoints()
  460. for _,v3 in pairs(Char:GetChildren()) do
  461. coroutine.resume(coroutine.create(function()
  462. if v3:IsA("Humanoid") then
  463. else
  464. v3:Destroy()
  465. end
  466.  
  467. end))
  468. end
  469. CHARACTER.Classification:Clone().Parent=Cloneed
  470. Char =Cloneed
  471. Char.Parent = RealPar
  472. local hum = Char:FindFirstChildOfClass("Humanoid")
  473. hum.PlatformStand = true
  474. local rval = math.random(1,4)
  475. local TORSO2 = Char:FindFirstChild("Torso") or Char:FindFirstChild("UpperTorso")
  476. if rval == 1 then
  477. local SOUND = CreateSound(1835338424, TORSO2, 2.5, 1, false)
  478. elseif rval == 2 then
  479. local SOUND = CreateSound(130801781, TORSO2, 2.5, 1, false)
  480. elseif rval == 3 then
  481. local SOUND = CreateSound(402192395, TORSO2, 2.5, 1, false)
  482. elseif rval == 4 then
  483. local SOUND = CreateSound(727068345, TORSO2, 2.5, 1, false)
  484. end
  485.  
  486. coroutine.resume(coroutine.create(function()
  487. wait(4)
  488. if hum.Health >0.001 then
  489.  
  490. local Zombie = Minion:Clone()
  491. local infect2 = Minion:Clone()
  492. infect2.Parent = Zombie
  493. Zombie.AI.Disabled = false
  494. TORSO2 = Char:FindFirstChild("Torso") or Char:FindFirstChild("UpperTorso")
  495.  
  496.  
  497. for i, v3 in pairs(GatherAllInstances(Char)) do
  498. if v3:isA("Accessory") then
  499. v3.Parent = Zombie
  500. end
  501. if v3:isA("Hat") then
  502. v3.Parent = Zombie
  503. end
  504. if v3:isA("CharacterMesh") then
  505. v3.Parent = Zombie
  506. end
  507. if v3:isA("Decal") and v3.Parent.Name == "Head" then
  508. v3.Parent = Zombie.Head
  509. end
  510.  
  511.  
  512. end
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519. Zombie.Parent = Char.Parent
  520. Zombie.Torso.CFrame = TORSO2.CFrame
  521. Char:Destroy()
  522.  
  523.  
  524. else
  525. Char:Destroy()
  526.  
  527. end
  528. end))
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537. end
  538.  
  539. function ApplyDamage(Humanoid,Damage)
  540. Damage = Damage * 1
  541.  
  542. local SOUND = CreateSound(610359515, RightArm, 1.0, 1.5, false)
  543.  
  544. if game.Players:FindFirstChild(Humanoid.Parent.Name) then
  545. local PLR = game.Players:FindFirstChild(Humanoid.Parent.Name)
  546. local GUI = script.BloodGui:Clone()
  547. GUI.Parent = PLR.PlayerGui
  548. GUI.Scrip.Disabled = false
  549. end
  550. if Humanoid.Health - Damage < 0.000001 then
  551. --Tuant:Play()
  552.  
  553.  
  554. local Zombie = Humanoid.Parent
  555. Humanoid.PlatformStand = true
  556. infect(Zombie)
  557.  
  558.  
  559.  
  560. end
  561.  
  562.  
  563. if Humanoid.Health ~= 0 then
  564. Humanoid.Health = Humanoid.Health - Damage
  565. end
  566. end
  567.  
  568. function Raycast(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS)
  569. return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS)
  570. end
  571.  
  572.  
  573.  
  574.  
  575.  
  576. --//=================================\\
  577. --|| ATRIFICIAL INTELLIGENCE
  578. --\\=================================//
  579.  
  580. function Attack1()
  581. local POS = TORSO.CFrame * CF(0,0,-12*Pscale)
  582. local HIT = false
  583. Attack = true
  584. AnimSpeed=.15
  585. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  586. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  587. --Arms
  588. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(170),math.rad(0),math.rad(20))},"Quad","InOut",AnimSpeed)
  589. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(50),math.rad(0),math.rad(-20))},"Quad","InOut",AnimSpeed) --]]
  590.  
  591. for i = 1, 5 do
  592. Swait()
  593. TORSO.CFrame = TORSO.CFrame * CF(0,0,(5-i)/10)
  594. end
  595. --ATTACKA:Play()
  596. --ATTACKA:AdjustSpeed(2.5)
  597. wait(0.1)
  598. AnimSpeed =.3
  599. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(10),math.rad(0),math.rad(20))},"Quad","InOut",AnimSpeed)
  600. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(30),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  601. --Arms
  602. SetTween(RS,{C0=CF2(1.25,.5,-.1)*ANGLES(math.rad(60),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed)
  603. SetTween(LS,{C0=CF2(-1.35,.6,-.0)*ANGLES(math.rad(-20),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed) --]]
  604. local SOUND = CreateSound(305734380, RightArm, 1.5, 1.0, false)
  605. for i = 1, 12 do
  606. if DEAD == true then
  607. break
  608. end
  609. RightArm.Flame:Emit(10)
  610. RightArm.Sparks:Emit(5)
  611. TORSO.CFrame = Clerp(TORSO.CFrame,POS,0.1)
  612. for index, CHILD in pairs(workspace:GetDescendants()) do
  613. local Pass = false
  614. if CHILD:FindFirstChild("Classification") and CHILD:FindFirstChild("Classification").Value == CLASSIFICATION then
  615. Pass=true
  616. end
  617.  
  618. if CHILD.ClassName == "Model" and CHILD ~= CHARACTER and Pass == false then
  619. local HUM = CHILD:FindFirstChildOfClass("Humanoid")
  620. if HUM then
  621. local TORSO2 = CHILD:FindFirstChild("Torso") or CHILD:FindFirstChild("UpperTorso")
  622. if TORSO2 then
  623. if (TORSO2.Position - TORSO.CFrame*CF(0,0,-1).p).Magnitude <= 3*Pscale then
  624. local DMG = MRANDOM(35,45)
  625. ApplyDamage(HUM,DMG)
  626. HIT = true
  627. end
  628. end
  629. end
  630. end
  631. end
  632. if HIT == true then
  633. break
  634. end
  635. Swait()
  636. end
  637.  
  638.  
  639.  
  640. wait(.5)
  641. Attack = false
  642. end
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659. function ApplyAoE(POSITION,RANGE,MINDMG,MAXDMG,FLING,INSTAKILL)
  660. for index, CHILD in pairs(workspace:GetDescendants()) do
  661. if CHILD.ClassName == "Model" and CHILD ~= CHARACTER then
  662. local HUM = CHILD:FindFirstChildOfClass("Humanoid")
  663.  
  664. local Pass=false
  665. if CHILD:FindFirstChild("Classification") and CHILD:FindFirstChild("Classification").Value == CLASSIFICATION then
  666. Pass=true
  667. end
  668. if HUM and Pass == false then
  669. local TORSO = CHILD:FindFirstChild("Torso") or CHILD:FindFirstChild("UpperTorso")
  670. if TORSO then
  671. if (TORSO.Position - POSITION).Magnitude <= RANGE then
  672. if INSTAKILL == true then
  673. CHILD:BreakJoints()
  674. else
  675. local DMG = MRANDOM(MINDMG,MAXDMG)
  676. ApplyDamage(HUM,DMG)
  677. end
  678. if FLING > 0 then
  679. for _, c in pairs(CHILD:GetChildren()) do
  680. if c:IsA("BasePart") then
  681. local bv = Instance.new("BodyVelocity")
  682. bv.maxForce = Vector3.new(1e9, 1e9, 1e9)
  683. bv.velocity = CF(POSITION,TORSO.Position).lookVector*FLING
  684. bv.Parent = c
  685. Debris:AddItem(bv,0.05)
  686. end
  687. end
  688. end
  689. end
  690. end
  691. end
  692. end
  693. end
  694. end
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702. function Attack2()
  703. Attack = true
  704. local POS = TORSO.CFrame * CF(0,0,-6)
  705. local HIT = false
  706. for i = 1, 5 do
  707. Swait()
  708. TORSO.CFrame = TORSO.CFrame * CF(0,0,(5-i)/10)
  709. end
  710. AnimSpeed =.3
  711. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(10),math.rad(0),math.rad(-20))},"Quad","InOut",AnimSpeed)
  712. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(30),math.rad(0),math.rad(20))},"Quad","InOut",AnimSpeed)
  713. --Arms
  714. SetTween(RS,{C0=CF2(1.25,.5,-.1)*ANGLES(math.rad(60),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed)
  715. SetTween(LS,{C0=CF2(-1.35,.6,-.0)*ANGLES(math.rad(-20),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed) --]]
  716.  
  717. wait(AnimSpeed)
  718.  
  719. local RPP = RootPart.Position
  720. local lookv= RootPart.CFrame.lookVector
  721. coroutine.resume(coroutine.create(function()
  722. for i = 1,10,1 do
  723. local attackP = RPP+lookv*i*6
  724. local attackCF = CF(attackP,attackP+lookv*1)
  725.  
  726. WACKYEFFECT({Time = 30,EffectType = "Sphere", Size = VT(2,0,10), Size2 = VT(2,60,10), Transparency = .5, Transparency2 = 1, CFrame = attackCF*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 0, RotationZ = 0, Material = "Neon", Color = C3(1,0,.5), SoundID = 1452071798, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 1.25})
  727. WACKYEFFECT({Time = 20,EffectType = "Wave", Size = VT(0,0,10), Size2 = VT(2,60,10), Transparency = 0.8, Transparency2 = 1, CFrame = attackCF*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 1, RotationY = 0, RotationZ = math.random(-10,10)/10, Material = "Neon", Color = C3(1,1,1), SoundID = nil, SoundPitch = nil, SoundVolume = nil})
  728.  
  729. ApplyAoE(attackP,6,3,5,12,false)
  730.  
  731. Swait(5)
  732. end
  733. end))
  734.  
  735.  
  736. AnimSpeed =.3
  737. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(-10),math.rad(0),math.rad(20))},"Quad","InOut",AnimSpeed)
  738. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(-30),math.rad(0),math.rad(-20))},"Quad","InOut",AnimSpeed)
  739. --Arms
  740. SetTween(RS,{C0=CF2(1.5,.5,-.1)*ANGLES(math.rad(160),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed)
  741. SetTween(LS,{C0=CF2(-1.35,.6,-.0)*ANGLES(math.rad(-0),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed) --]]
  742.  
  743. wait(AnimSpeed)
  744.  
  745. Attack = false
  746. end
  747.  
  748.  
  749. function Attack3()
  750. Attack = true
  751. local POS = TORSO.CFrame * CF(0,0,-6)
  752. local HIT = false
  753. for i = 1, 5 do
  754. Swait()
  755. TORSO.CFrame = TORSO.CFrame * CF(0,0,(5-i)/10)
  756. end
  757. AnimSpeed =.3
  758. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(10),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed)
  759. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(30),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  760. --Arms
  761. SetTween(RS,{C0=CF2(1.5,.5,-.0)*ANGLES(math.rad(-20),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed)
  762. SetTween(LS,{C0=CF2(-1.5,.5,-.0)*ANGLES(math.rad(-20),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed) --]]
  763.  
  764. wait(AnimSpeed)
  765.  
  766. local RPP = RootPart.Position
  767. local lookv= RootPart.CFrame.lookVector
  768. local attackP = RPP+lookv*6
  769. local attackCF = CF(attackP,attackP+lookv*1)
  770.  
  771.  
  772.  
  773.  
  774. WACKYEFFECT({Time = 30,EffectType = "Sphere", Size = VT(5,0,5), Size2 = VT(200,1,200), Transparency = .5, Transparency2 = 1, CFrame = attackCF*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 0, RotationZ = 0, Material = "Neon", Color = C3(1,0,.5), SoundID = 1452071798, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 2})
  775. WACKYEFFECT({Time = 30,EffectType = "Wave", Size = VT(20,0,20), Size2 = VT(200,10,200), Transparency = 0.8, Transparency2 = 1, CFrame = attackCF*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 10, RotationZ = 0, Material = "Neon", Color = C3(1,1,1), SoundID = nil, SoundPitch = nil, SoundVolume = nil})
  776.  
  777. coroutine.resume(coroutine.create(function()
  778. for i = 0,20 do Swait()
  779. coroutine.resume(coroutine.create(function()
  780.  
  781. local BlastPos = attackCF*CF(math.random(-50,50),0,math.random(-50,50))
  782.  
  783. WACKYEFFECT({Time = 20,EffectType = "Sphere", Size = VT(10,1,10), Size2 = VT(0,1,0), Transparency = .5, Transparency2 = 1, CFrame = BlastPos*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 0, RotationZ = 0, Material = "Neon", Color = C3(1,1,1), SoundID = 588738949, SoundPitch = 1, SoundVolume = 2})
  784.  
  785. wait(1)
  786. WACKYEFFECT({Time = 40,EffectType = "Sphere", Size = VT(5,0,5), Size2 = VT(10,60,10), Transparency = .5, Transparency2 = 1, CFrame = BlastPos*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 0, RotationZ = 0, Material = "Neon", Color = C3(1,0,.5), SoundID = 610359590, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 1.5})
  787. WACKYEFFECT({Time = 30,EffectType = "Wave", Size = VT(20,0,20), Size2 = VT(10,10,10), Transparency = 0.8, Transparency2 = 1, CFrame = BlastPos*CF(0,-2.5*Pscale,0), MoveToPos = nil, RotationX = 0, RotationY = 2, RotationZ = 0, Material = "Neon", Color = C3(1,1,1), SoundID = nil, SoundPitch = nil, SoundVolume = nil})
  788. ApplyAoE(BlastPos.p,10,13,15,32,false)
  789.  
  790. end))
  791. end
  792. end))
  793.  
  794.  
  795. AnimSpeed =1
  796. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(-10),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  797. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(-30),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed)
  798. --Arms
  799. SetTween(RS,{C0=CF2(1.25,.5,-.1)*ANGLES(math.rad(150),math.rad(0),math.rad(-25))},"Quad","InOut",AnimSpeed)
  800. SetTween(LS,{C0=CF2(-1.25,.5,-.1)*ANGLES(math.rad(150),math.rad(0),math.rad(25))},"Quad","InOut",AnimSpeed) --]]
  801.  
  802. wait(AnimSpeed)
  803. AnimSpeed =.25
  804. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  805. SetTween(Neck,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(-0))},"Quad","InOut",AnimSpeed)
  806. --Arms
  807. SetTween(RS,{C0=CF2(1.5,.5,-.0)*ANGLES(math.rad(90),math.rad(0),math.rad(90))},"Quad","InOut",AnimSpeed)
  808. SetTween(LS,{C0=CF2(-1.5,.5,-.0)*ANGLES(math.rad(90),math.rad(0),math.rad(-90))},"Quad","InOut",AnimSpeed) --]]
  809.  
  810. wait(AnimSpeed)
  811. Attack = false
  812. wait(AnimSpeed)
  813. end
  814.  
  815. function intro()
  816. Attack = true
  817. coroutine.resume(coroutine.create(function()
  818. local SCRIPTS = {}
  819. for index, CHILD in pairs(game.Players:GetChildren()) do
  820. local SCRIPT = script.Cutscene:Clone()
  821. SCRIPT.Parent = CHILD.PlayerGui
  822. SCRIPT.Disabled = false
  823. script.AttachPart:Clone().Parent = SCRIPT
  824. script.TestFor:Clone().Parent = SCRIPT
  825. script.Dist:Clone().Parent = SCRIPT
  826. table.insert(SCRIPTS,SCRIPT)
  827. end
  828. for E = 1, #SCRIPTS do
  829. SCRIPTS[E].Dist.Value = 13.5
  830. end
  831.  
  832.  
  833. wait(1)
  834. for i = 15,25,0.1 do
  835. for E = 1, #SCRIPTS do
  836. SCRIPTS[E].Dist.Value = i
  837. end
  838. Swait()
  839. end
  840.  
  841. wait(.1)
  842.  
  843. CHARACTER.FixValue.Value = true
  844. for E = 1, #SCRIPTS do
  845. Debris:AddItem(SCRIPTS[E],12)
  846. end
  847.  
  848. wait(.1)
  849. CHARACTER.FixValue.Value = false
  850. end))
  851. AnimSpeed=1.5/2
  852. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  853. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(40),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  854. --Arms
  855. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(90),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  856. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed) --]]
  857.  
  858. local SOUND = CreateSound(907329532, Torso, 1.5, 1.2, false)
  859. wait(AnimSpeed)
  860. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  861. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(20),math.rad(0))},"Quad","InOut",AnimSpeed)
  862. --Arms
  863. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(90),math.rad(0),math.rad(90))},"Quad","InOut",AnimSpeed)
  864. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed) --]]
  865. wait(AnimSpeed)
  866. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  867. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  868. --Arms
  869. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(50),math.rad(0),math.rad(20))},"Quad","InOut",AnimSpeed)
  870. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed) --]]
  871. wait(AnimSpeed)
  872. music:Play()
  873. Attack = false
  874. end
  875.  
  876. --//=================================\\
  877. --|| WRAP
  878. --\\=================================//
  879. wait(.5)
  880. intro()
  881. function BEGINAI()
  882. if CHARACTER.Zombie.Value == true then
  883. ARMS:Play()
  884. end
  885. HUMANOID.Died:Connect(function()
  886. DEAD = true
  887. for index, CHILD in pairs(CHARACTER:GetDescendants()) do
  888. if CHILD:IsA("BasePart") then
  889. CHILD.Anchored = true
  890.  
  891. coroutine.resume(coroutine.create(function()
  892. wait(math.random(100,150)/1000)
  893.  
  894. WACKYEFFECT({Time = 65,EffectType = "Box", Size = CHILD.Size*1.1, Size2 = VT(0,0,0), Transparency = 0, Transparency2 = 1, CFrame = CHILD.CFrame, MoveToPos = CHILD.CFrame.p+VT(math.random(-5,5),math.random(-5,5),math.random(-5,5)), RotationX = math.random(-50,50)/100, RotationY = math.random(-50,50)/100, RotationZ = math.random(-50,50)/100, Material = "Neon", Color = C3(1,.5,0), SoundID = nil, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 2})
  895. WACKYEFFECT({Time = 65,EffectType = "Box", Size = CHILD.Size*1.1, Size2 = VT(0,0,0), Transparency = 0, Transparency2 = 1, CFrame = CHILD.CFrame, MoveToPos = CHILD.CFrame.p+VT(math.random(-5,5),math.random(-5,5),math.random(-5,5)), RotationX = math.random(-50,50)/100, RotationY = math.random(-50,50)/100, RotationZ = math.random(-50,50)/100, Material = "Neon", Color = C3(1,.5,0), SoundID = nil, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 2})
  896. WACKYEFFECT({Time = 65,EffectType = "Box", Size = CHILD.Size*1.1, Size2 = VT(0,0,0), Transparency = 0, Transparency2 = 1, CFrame = CHILD.CFrame, MoveToPos = CHILD.CFrame.p+VT(math.random(-5,5),math.random(-5,5),math.random(-5,5)), RotationX = math.random(-50,50)/100, RotationY = math.random(-50,50)/100, RotationZ = math.random(-50,50)/100, Material = "Neon", Color = C3(1,.5,0), SoundID = nil, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 2})
  897. WACKYEFFECT({Time = 65,EffectType = "Box", Size = CHILD.Size*1.1, Size2 = VT(0,0,0), Transparency = 0, Transparency2 = 1, CFrame = CHILD.CFrame, MoveToPos = CHILD.CFrame.p+VT(math.random(-5,5),math.random(-5,5),math.random(-5,5)), RotationX = math.random(-50,50)/100, RotationY = math.random(-50,50)/100, RotationZ = math.random(-50,50)/100, Material = "Neon", Color = C3(1,.5,0), SoundID = nil, SoundPitch = MRANDOM(18,22)/10, SoundVolume = 2})
  898.  
  899. CHILD:Destroy()
  900. end))
  901.  
  902.  
  903. end
  904. end
  905.  
  906.  
  907. print("Dead")
  908. coroutine.resume(coroutine.create(function()
  909. if music.Parent == CHARACTER then
  910. while music.Volume > 0.001 do
  911. music.Volume = music.Volume -0.1
  912. wait()
  913. end
  914.  
  915.  
  916. music:Stop()
  917. end
  918. end))
  919. local SOUND = CreateSound(260434750, workspace, 1.5, 1, false)
  920.  
  921. Debris:AddItem(CHARACTER,15)
  922.  
  923. end)
  924. while true do
  925. if DEAD == true then
  926. break
  927. end
  928. local TARGETVARIANTS = {}
  929. local TARGET = nil
  930. for index, CHILD in pairs(workspace:GetChildren()) do
  931. local HUMAN = CHILD:FindFirstChildOfClass("Humanoid")
  932. if HUMAN then
  933. if HUMAN.Health > 0 then
  934. if HUMAN.Torso then
  935. local PASS = true
  936. if CHILD:FindFirstChild("Classification") then
  937. if CHILD:FindFirstChild("Classification").Value == CLASSIFICATION then
  938. PASS = false
  939. end
  940. end
  941. if PASS == true then
  942. local DISTANCE = (HUMAN.Torso.Position - HED.Position).Magnitude
  943. table.insert(TARGETVARIANTS,{CHILD,DISTANCE})
  944. end
  945. end
  946. end
  947. end
  948. end
  949. local DIST = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999
  950. for E = 1, #TARGETVARIANTS do
  951. local PLAYER = TARGETVARIANTS[E]
  952. local CHARACTER = PLAYER[1]
  953. local DISTANCE = PLAYER[2]
  954. if DISTANCE < DIST then
  955. DIST = DISTANCE
  956. TARGET = CHARACTER
  957. end
  958. end
  959. if TARGET and TARGET:FindFirstChildOfClass("Humanoid") then
  960. local HUM = TARGET:FindFirstChildOfClass("Humanoid")
  961. local ROOT = HUM.Torso
  962. if ROOT then
  963. if DIST < 8*Pscale then
  964. HUMANOID:MoveTo(TORSO.Position)
  965. local POS = VT(ROOT.Position.X,TORSO.Position.Y,ROOT.Position.Z)
  966. TORSO.CFrame = Clerp(TORSO.CFrame,CF(TORSO.Position,POS),0.3)
  967. local Cattack = MRANDOM(1,4)
  968. if MRANDOM(1,5) == 1 then
  969.  
  970. if Cattack == 1 then
  971. Attack1()
  972. elseif Cattack == 2 then
  973. Attack2()
  974. elseif Cattack == 3 then
  975. Attack3()
  976. elseif Cattack == 4 then
  977. -- Attack4()
  978. elseif Cattack == 5 then
  979.  
  980. end
  981.  
  982.  
  983. end
  984. else
  985. HUMANOID:MoveTo(ROOT.Position)
  986. end
  987. end
  988. end
  989. wait()
  990. end
  991.  
  992.  
  993.  
  994.  
  995. end
  996. coroutine.resume(coroutine.create(function()
  997. BEGINAI() end))
  998.  
  999. while DEAD == false do
  1000.  
  1001. AnimP = AnimP +1
  1002. if AnimP > 4 then
  1003. AnimP=1
  1004. end
  1005.  
  1006.  
  1007. hitfloor = Raycast(RootPart.Position, CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4*Pscale, CHARACTER)
  1008.  
  1009. local torvel = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
  1010. local velderp = RootPart.Velocity.y
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019. inairvel=torvel
  1020.  
  1021.  
  1022. if inairvel > 30 then
  1023. inairvel=30
  1024. end
  1025. inairvel=inairvel/50
  1026. if RootPart.Velocity.y > 1 and hitfloor == nil then
  1027. Anim = "Jump"
  1028. elseif RootPart.Velocity.y < -1 and hitfloor == nil then
  1029. Anim = "Fall"
  1030. elseif HUMANOID.Sit == true then
  1031. Anim = "Sit"
  1032. elseif torvel < 1 and hitfloor ~= nil then
  1033. Anim = "Idle"
  1034. elseif torvel > 2 and hitfloor ~= nil then
  1035.  
  1036. Anim = "Walk"
  1037.  
  1038. else
  1039. Anim = ""
  1040.  
  1041. end
  1042.  
  1043.  
  1044.  
  1045. if Attack == false then
  1046. AnimSpeed=.5
  1047. if Anim == "Idle" then
  1048. AnimSpeed=.4
  1049. if AnimP == 1 then
  1050.  
  1051. elseif AnimP == 2 then
  1052. ----------------------------------------------------------------------------------------------------------------
  1053. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1054. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(5),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1055. --Arms
  1056. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(2))},"Quad","InOut",AnimSpeed*2)
  1057. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(-2))},"Quad","InOut",AnimSpeed*2)
  1058.  
  1059. --Legs
  1060. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1061. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1062.  
  1063. elseif AnimP == 3 then
  1064.  
  1065. elseif AnimP == 4 then
  1066. ----------------------------------------------------------------------------------------------------------------
  1067. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1068. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1069. --Arms
  1070. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(2),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1071. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(2),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1072.  
  1073. --Legs
  1074. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1075. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed*2)
  1076.  
  1077. end
  1078. end
  1079.  
  1080.  
  1081. if Anim == "Walk" then
  1082. if AnimP == 1 then
  1083. ----------------------------------------------------------------------------------------------------------------
  1084. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(5),math.rad(0),math.rad(10))},"Linear","InOut",AnimSpeed)
  1085. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(-5),math.rad(0),math.rad(-10))},"Linear","InOut",AnimSpeed)
  1086. --Arms
  1087. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(70),math.rad(0),math.rad(5))},"Linear","InOut",AnimSpeed)
  1088. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(30),math.rad(0),math.rad(5))},"Linear","InOut",AnimSpeed)
  1089.  
  1090. --Legs
  1091. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(30),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1092. SetTween(LH,{C0=CF2(-.5,-1,-.3)*ANGLES(math.rad(-50),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1093. elseif AnimP == 2 then
  1094. ----------------------------------------------------------------------------------------------------------------
  1095. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1096. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1097.  
  1098. --Arms
  1099. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(60),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1100. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1101.  
  1102. --Legs
  1103. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(-30),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1104. SetTween(LH,{C0=CF2(-.5,-.5,-.2)*ANGLES(math.rad(-20),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1105. elseif AnimP == 3 then
  1106. ----------------------------------------------------------------------------------------------------------------
  1107. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(5),math.rad(0),math.rad(-10))},"Linear","InOut",AnimSpeed)
  1108. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(-5),math.rad(0),math.rad(10))},"Linear","InOut",AnimSpeed)
  1109. --Arms
  1110. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(70),math.rad(0),math.rad(-5))},"Linear","InOut",AnimSpeed)
  1111. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(-30),math.rad(0),math.rad(-5))},"Linear","InOut",AnimSpeed)
  1112.  
  1113. --Legs
  1114. SetTween(RH,{C0=CF2(.5,-1,-.3)*ANGLES(math.rad(-50),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1115. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(30),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1116. elseif AnimP == 4 then
  1117. ----------------------------------------------------------------------------------------------------------------
  1118. SetTween(RootJoint,{C0= RootCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1119. SetTween(Neck,{C0=NeckCF*CF2(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1120. --Arms
  1121. SetTween(RS,{C0=CF2(1.5,.5,0)*ANGLES(math.rad(60),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1122. SetTween(LS,{C0=CF2(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1123.  
  1124. --Legs
  1125. SetTween(RH,{C0=CF2(.5,-.5,-.2)*ANGLES(math.rad(-20),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1126. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(-30),math.rad(0),math.rad(0))},"Linear","InOut",AnimSpeed)
  1127.  
  1128. end
  1129. end
  1130. else
  1131. --[[
  1132. ----------------------------------------------------------------------------------------------------------------
  1133. SetTween(RootJoint,{C0= RootCF*CF(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  1134. SetTween(LS,{C0=NeckCF*CF(0,0,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  1135. --Arms
  1136. SetTween(RS,{C0=CF(1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  1137. SetTween(LS,{C0=CF(-1.5,.5,0)*ANGLES(math.rad(0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed) --]]
  1138. --Legs
  1139. SetTween(RH,{C0=CF2(.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  1140. SetTween(LH,{C0=CF2(-.5,-1,0)*ANGLES(math.rad(-0),math.rad(0),math.rad(0))},"Quad","InOut",AnimSpeed)
  1141.  
  1142. end
  1143. wait(AnimSpeed)
  1144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement