Advertisement
awzp

Bones scythe (not by me)

Jun 5th, 2018
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.76 KB | None | 0 0
  1. --Made by N3xul
  2. local runDummyScript = function(f,scri)
  3. local oldenv = getfenv(f)
  4. local newenv = setmetatable({}, {
  5. __index = function(_, k)
  6. if k:lower() == 'script' then
  7. return scri
  8. else
  9. return oldenv[k]
  10. end
  11. end
  12. })
  13. setfenv(f, newenv)
  14. ypcall(function() f() end)
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. mas.Name = "CompiledModel"
  19. o1 = Instance.new("Tool")
  20. o2 = Instance.new("Part")
  21. o3 = Instance.new("SpecialMesh")
  22. o4 = Instance.new("Sound")
  23. o5 = Instance.new("Sound")
  24. o7 = Instance.new("Script")
  25. o8 = Instance.new("LocalScript")
  26. o9 = Instance.new("Animation")
  27. o10 = Instance.new("Animation")
  28. o11 = Instance.new("Animation")
  29. o12 = Instance.new("LocalScript")
  30. o13 = Instance.new("Fire")
  31. o14 = Instance.new("Animation")
  32. o15 = Instance.new("Script")
  33. o1.Name = "BoneScythe"
  34. o1.Parent = mas
  35. o1.TextureId = "http://www.roblox.com/asset/?id=95891250"
  36. o1.GripForward = Vector3.new(-1, 0, -0)
  37. o1.GripPos = Vector3.new(0.939999998, -4.69999981, -0.159999996)
  38. o1.GripRight = Vector3.new(0, 0, -1)
  39. o2.Name = "Handle"
  40. o2.Parent = o1
  41. o2.Position = Vector3.new(-36.2000008, 9.70189285, 170.599991)
  42. o2.Rotation = Vector3.new(-0.00712239183, 2.90283042e-005, -0.0461782068)
  43. o2.FormFactor = Enum.FormFactor.Custom
  44. o2.Size = Vector3.new(4.59999704, 2.20000029, 0.500000358)
  45. o2.CFrame = CFrame.new(-36.2000008, 9.70189285, 170.599991, 0.999998569, 0.000805960735, 5.06639481e-007, -0.000806277676, 0.999998569, 0.000124309096, 8.94069672e-008, -0.000124018639, 0.999999285)
  46. o2.BottomSurface = Enum.SurfaceType.Smooth
  47. o2.TopSurface = Enum.SurfaceType.Smooth
  48. o2.Position = Vector3.new(-36.2000008, 9.70189285, 170.599991)
  49. o3.Parent = o2
  50. o3.MeshId = "http://www.roblox.com/asset/?id=95891318"
  51. o3.Scale = Vector3.new(0.800000012, 0.800000012, 0.800000012)
  52. o3.TextureId = "http://www.roblox.com/asset/?id=95891299"
  53. o3.MeshType = Enum.MeshType.FileMesh
  54. o4.Name = "SwordSlash"
  55. o4.Parent = o2
  56. o4.SoundId = "rbxasset://sounds//swordslash.wav"
  57. o4.Volume = 1
  58. o5.Name = "Gong"
  59. o5.Parent = o2
  60. o5.SoundId = "http://www.roblox.com/asset/?id=96098241"
  61. o5.Volume = 1
  62. o7.Name = "ScytheScript"
  63. o7.Parent = o1
  64. table.insert(cors,coroutine.create(function()
  65. wait()
  66. runDummyScript(function()
  67. -----------------
  68. --| Constants |--
  69. -----------------
  70.  
  71. local HIT_DAMAGE = 20
  72. local LIMB_DEBRIS_TIME = 4 --NOTE: Should be less than respawn time
  73.  
  74. local SLASH_COOLDOWN = 0.7
  75.  
  76. local IGNORE_LIST = {torso = 1, handle = 1, effect = 1, water = 1} --NOTE: Keys must be lowercase, values must evaluate to true
  77.  
  78. --------------------
  79. --| WaitForChild |--
  80. --------------------
  81.  
  82. -- Waits for parent.child to exist, then returns it
  83. local function WaitForChild(parent, childName)
  84. assert(parent, "ERROR: WaitForChild: parent is nil")
  85. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  86. return parent[childName]
  87. end
  88.  
  89. -----------------
  90. --| Variables |--
  91. -----------------
  92.  
  93. local DebrisService = Game:GetService('Debris')
  94. local PlayersService = Game:GetService('Players')
  95.  
  96. local Tool = script.Parent
  97. local ToolHandle = Tool.Handle
  98.  
  99. local MyModel = nil
  100. local MyPlayer = nil
  101.  
  102. -------------------------
  103. --| Utility Functions |--
  104. -------------------------
  105.  
  106. -- Returns a character ancestor and its Humanoid, or nil
  107. local function FindCharacterAncestor(subject)
  108. if subject and subject ~= Workspace then
  109. local humanoid = subject:FindFirstChild('Humanoid')
  110. if humanoid then
  111. return subject, humanoid
  112. else
  113. return FindCharacterAncestor(subject.Parent)
  114. end
  115. end
  116. return nil
  117. end
  118.  
  119. -- Removes any old creator tags and applies new ones to the specified target
  120. local function ApplyTags(target)
  121. while target:FindFirstChild('creator') do
  122. target.creator:Destroy()
  123. end
  124.  
  125. local creatorTag = Instance.new('ObjectValue')
  126. creatorTag.Value = MyPlayer
  127. creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  128.  
  129. local iconTag = Instance.new('StringValue')
  130. iconTag.Value = Tool.TextureId
  131. iconTag.Name = 'icon'
  132.  
  133. iconTag.Parent = creatorTag
  134. creatorTag.Parent = target
  135. DebrisService:AddItem(creatorTag, 4)
  136. end
  137.  
  138. -----------------------
  139. --| Other Functions |--
  140. -----------------------
  141.  
  142. local function OnTouched(otherPart)
  143. if otherPart and not IGNORE_LIST[string.lower(otherPart.Name)] then
  144. local character, humanoid = FindCharacterAncestor(otherPart)
  145. if character and humanoid and character ~= MyModel then
  146. ApplyTags(humanoid)
  147. humanoid:TakeDamage(HIT_DAMAGE)
  148. if humanoid.Health > 0 and humanoid.Torso then -- Cut limbs
  149. for _, child in pairs(humanoid.Torso:GetChildren()) do
  150. if child:IsA('JointInstance') and (child.Part0 == otherPart or child.Part1 == otherPart) then
  151. child:Destroy()
  152. DebrisService:AddItem(otherPart, LIMB_DEBRIS_TIME)
  153. otherPart.Parent = Workspace
  154. otherPart.CanCollide = true
  155. end
  156. end
  157. end
  158. end
  159. end
  160. end
  161.  
  162. local function OnEquipped()
  163. MyModel = Tool.Parent
  164. MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
  165. end
  166.  
  167. local function OnActivated()
  168. if Tool.Enabled and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
  169. Tool.Enabled = false --NOTE: Starts the animation
  170.  
  171. local connection = ToolHandle.Touched:connect(OnTouched)
  172. Delay(0.4, function() --NOTE: Hardcoded length of animation :[
  173. if connection then
  174. connection:disconnect()
  175. end
  176. end)
  177.  
  178. local slashSound = ToolHandle:FindFirstChild('SwordSlash')
  179. if slashSound then
  180. slashSound:Play()
  181. end
  182.  
  183. wait(SLASH_COOLDOWN)
  184.  
  185. Tool.Enabled = true
  186. end
  187. end
  188.  
  189. --------------------
  190. --| Script Logic |--
  191. --------------------
  192.  
  193. Tool.Equipped:connect(OnEquipped)
  194. Tool.Activated:connect(OnActivated)
  195.  
  196. end,o7)
  197. end))
  198. o8.Name = "MostAnimations"
  199. o8.Parent = o1
  200. table.insert(cors,coroutine.create(function()
  201. wait()
  202. runDummyScript(function()
  203. --------------------
  204. --| WaitForChild |--
  205. --------------------
  206.  
  207. -- Waits for parent.child to exist, then returns it
  208. local function WaitForChild(parent, childName)
  209. assert(parent, "ERROR: WaitForChild: parent is nil")
  210. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  211. return parent[childName]
  212. end
  213.  
  214. -----------------
  215. --| Variables |--
  216. -----------------
  217.  
  218. local Tool = script.Parent
  219.  
  220. local ScytheEquipAnimation = WaitForChild(script, 'ScytheEquip2')
  221. local ScytheIdleAnimation = WaitForChild(script, 'ScytheIdle2')
  222. local ScytheSlashAnimation = WaitForChild(script, 'ScytheSlash')
  223.  
  224. local ScytheEquipTrack = nil
  225. local ScytheIdleTrack = nil
  226. local ScytheSlashTrack = nil
  227.  
  228. -----------------
  229. --| Functions |--
  230. -----------------
  231.  
  232. local function OnEquipped()
  233. local myModel = Tool.Parent
  234. local humanoid = myModel:FindFirstChild('Humanoid')
  235. if humanoid then -- Preload animations
  236. ScytheEquipTrack = humanoid:LoadAnimation(ScytheEquipAnimation)
  237. if ScytheEquipTrack then ScytheEquipTrack:Play() end
  238.  
  239. ScytheIdleTrack = humanoid:LoadAnimation(ScytheIdleAnimation)
  240. if ScytheIdleTrack then ScytheIdleTrack:Play() end
  241.  
  242. ScytheSlashTrack = humanoid:LoadAnimation(ScytheSlashAnimation)
  243. end
  244. end
  245.  
  246. local function OnChanged(property)
  247. if property == 'Enabled' and Tool.Enabled == false then
  248. if ScytheSlashTrack then ScytheSlashTrack:Play() end
  249. end
  250. end
  251.  
  252. local function OnUnequipped()
  253. -- Stop all animations
  254. if ScytheEquipTrack then ScytheEquipTrack:Stop() end
  255. if ScytheIdleTrack then ScytheIdleTrack:Stop() end
  256. if ScytheSlashTrack then ScytheSlashTrack:Stop() end
  257. end
  258.  
  259. --------------------
  260. --| Script Logic |--
  261. --------------------
  262.  
  263. Tool.Equipped:connect(OnEquipped)
  264. Tool.Changed:connect(OnChanged)
  265. Tool.Unequipped:connect(OnUnequipped)
  266.  
  267. end,o8)
  268. end))
  269. o9.Name = "ScytheEquip2"
  270. o9.Parent = o8
  271. o9.AnimationId = "http://www.roblox.com/Asset?ID=96064636"
  272. o10.Name = "ScytheIdle2"
  273. o10.Parent = o8
  274. o10.AnimationId = "http://www.roblox.com/Asset?ID=96065457"
  275. o11.Name = "ScytheSlash"
  276. o11.Parent = o8
  277. o11.AnimationId = "http://www.roblox.com/Asset?ID=96071496"
  278. o12.Name = "RaiseSkeletons"
  279. o12.Parent = o1
  280. table.insert(cors,coroutine.create(function()
  281. wait()
  282. runDummyScript(function()
  283. -----------------
  284. --| Constants |--
  285. -----------------
  286.  
  287. local SPAWN_RADIUS = 8 -- Studs
  288.  
  289. local SUMMON_COOLDOWN = 8
  290.  
  291. local SKELETON_ASSET_ID = 53604463
  292.  
  293. local SKELETON_DURATION = 30
  294.  
  295. --------------------
  296. --| WaitForChild |--
  297. --------------------
  298.  
  299. -- Waits for parent.child to exist, then returns it
  300. local function WaitForChild(parent, childName)
  301. assert(parent, "ERROR: WaitForChild: parent is nil")
  302. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  303. return parent[childName]
  304. end
  305.  
  306. -----------------
  307. --| Variables |--
  308. -----------------
  309.  
  310. local InsertService = Game:GetService('InsertService')
  311. local DebrisService = Game:GetService('Debris')
  312. local PlayersService = Game:GetService('Players')
  313.  
  314. local Tool = script.Parent
  315. local ToolHandle = Tool.Handle
  316.  
  317. local MyPlayer = PlayersService.LocalPlayer
  318.  
  319. local SkeletonScript = WaitForChild(script, 'SkeletonScript')
  320. local Fire = WaitForChild(script, 'Fire')
  321. local SummonAnimation = WaitForChild(script, 'Summon')
  322.  
  323. local GongSound = WaitForChild(ToolHandle, 'Gong')
  324.  
  325. local MyModel = nil
  326. local Skeleton = nil
  327. local LastSummonTime = 0
  328. local SummonTrack = nil
  329.  
  330. -----------------
  331. --| Functions |--
  332. -----------------
  333.  
  334. local function MakeSkeleton()
  335. Skeleton = InsertService:LoadAsset(SKELETON_ASSET_ID):GetChildren()[1]
  336. if Skeleton then
  337. local head = Skeleton:FindFirstChild('Head')
  338. if head then
  339. head.Transparency = 0.99
  340. end
  341.  
  342. local skeletonScriptClone = SkeletonScript:Clone()
  343. skeletonScriptClone.Parent = Skeleton
  344. skeletonScriptClone.Disabled = false
  345.  
  346. local creatorTag = Instance.new('ObjectValue')
  347. creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  348. creatorTag.Value = MyPlayer
  349. local iconTag = Instance.new('StringValue', creatorTag)
  350. iconTag.Name = 'icon'
  351. iconTag.Value = Tool.TextureId
  352. creatorTag.Parent = Skeleton
  353. end
  354. end
  355.  
  356. local function SpawnSkeleton(spawnPosition)
  357. if Skeleton then
  358. -- Hellfire
  359. local firePart = Instance.new('Part')
  360. firePart.Name = 'Effect'
  361. firePart.Transparency = 1
  362. firePart.FormFactor = Enum.FormFactor.Custom
  363. firePart.Size = Vector3.new()
  364. firePart.Anchored = true
  365. firePart.CanCollide = false
  366. firePart.CFrame = CFrame.new(spawnPosition - Vector3.new(0, 4, 0))
  367. local fireClone = Fire:Clone()
  368. fireClone.Parent = firePart
  369. Delay(0.5, function()
  370. if fireClone then
  371. fireClone.Enabled = false
  372. end
  373. end)
  374. DebrisService:AddItem(firePart, 3)
  375. firePart.Parent = Workspace
  376.  
  377. -- Spawn
  378. local skeletonClone = Skeleton:Clone()
  379. DebrisService:AddItem(skeletonClone, SKELETON_DURATION)
  380. skeletonClone.Parent = Workspace
  381. skeletonClone:MoveTo(spawnPosition) --NOTE: Model must be in Workspace
  382.  
  383. -- Rise!
  384. local torso = skeletonClone:FindFirstChild('Torso')
  385. if torso then
  386. torso.CFrame = torso.CFrame - Vector3.new(0, 4.5, 0)
  387. for i = 0, 4.5, 0.45 do
  388. torso.CFrame = torso.CFrame + Vector3.new(0, i, 0)
  389. wait(1/30)
  390. end
  391. end
  392. end
  393. end
  394.  
  395. local function RaiseSkeletons()
  396. if not Skeleton then -- Try again
  397. MakeSkeleton()
  398. end
  399. for theta = -135, -45, 45 do
  400. SpawnSkeleton(MyModel.Torso.CFrame:pointToWorldSpace(Vector3.new(math.cos(theta), 0, math.sin(theta)) * SPAWN_RADIUS))
  401. end
  402. end
  403.  
  404. --NOTE: Ugly!
  405. local function OnKeyDown(key)
  406. key = string.lower(key)
  407. if key == 'e' then
  408. local now = time()
  409. if now > LastSummonTime + SUMMON_COOLDOWN then
  410. LastSummonTime = now
  411. local humanoid = MyModel:FindFirstChild('Humanoid')
  412. if humanoid then
  413. humanoid.WalkSpeed = 0
  414. end
  415. Spawn(function()
  416. for i = 1, 3 do
  417. if GongSound then GongSound:Play() end
  418. wait(1.5)
  419. end
  420. end)
  421. if SummonTrack then
  422. SummonTrack:Play()
  423. wait(3.125)
  424. end
  425. RaiseSkeletons()
  426. wait(1)
  427. if humanoid then
  428. humanoid.WalkSpeed = 16
  429. end
  430. end
  431. end
  432. end
  433.  
  434. local function OnEquipped(mouse)
  435. MyModel = Tool.Parent
  436. mouse.KeyDown:connect(OnKeyDown)
  437.  
  438. local humanoid = MyModel:FindFirstChild('Humanoid')
  439. if humanoid then -- Preload animations
  440. SummonTrack = humanoid:LoadAnimation(SummonAnimation)
  441. end
  442. end
  443.  
  444. local function OnUnequipped()
  445. if SummonTrack then SummonTrack:Stop() end
  446. end
  447.  
  448. --------------------
  449. --| Script Logic |--
  450. --------------------
  451.  
  452. MakeSkeleton()
  453. Tool.Equipped:connect(OnEquipped)
  454. Tool.Unequipped:connect(OnUnequipped)
  455.  
  456. end,o12)
  457. end))
  458. o13.Parent = o12
  459. o13.Size = 10
  460. o13.Color = Color3.new(1, 0, 0)
  461. o13.Heat = 25
  462. o13.SecondaryColor = Color3.new(0, 0, 0)
  463. o14.Name = "Summon"
  464. o14.Parent = o12
  465. o14.AnimationId = "http://www.roblox.com/Asset?ID=93693205"
  466. o15.Name = "SkeletonScript"
  467. o15.Parent = o12
  468. o15.Disabled = true
  469. table.insert(cors,coroutine.create(function()
  470. wait()
  471. runDummyScript(function()
  472. --Made by Stickmasterluke
  473.  
  474. --Zombie artificial stupidity script
  475. --(Modified for skeletons)
  476.  
  477. sp=script.Parent
  478. lastattack=0
  479. nextrandom=0
  480. --nextsound=0
  481. nextjump=0
  482. chasing=false
  483.  
  484. variance=4
  485.  
  486. damage=11
  487. attackrange=4.5
  488. sightrange=60
  489. runspeed=18
  490. wonderspeed=8
  491. healthregen=false
  492. colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
  493.  
  494. function raycast(spos,vec,currentdist)
  495. local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
  496. if hit2~=nil and pos2 then
  497. if hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" then
  498. local currentdist=currentdist-(pos2-spos).magnitude
  499. return raycast(pos2,vec,currentdist)
  500. end
  501. end
  502. return hit2,pos2
  503. end
  504.  
  505. function waitForChild(parent,childName)
  506. local child=parent:findFirstChild(childName)
  507. if child then return child end
  508. while true do
  509. child=parent.ChildAdded:wait()
  510. if child.Name==childName then return child end
  511. end
  512. end
  513.  
  514. -- ANIMATION
  515.  
  516. -- declarations
  517.  
  518. local Torso=waitForChild(sp,"Torso")
  519. local Head=waitForChild(sp,"Head")
  520. local RightShoulder=waitForChild(Torso,"Right Shoulder")
  521. local LeftShoulder=waitForChild(Torso,"Left Shoulder")
  522. local RightHip=waitForChild(Torso,"Right Hip")
  523. local LeftHip=waitForChild(Torso,"Left Hip")
  524. local Neck=waitForChild(Torso,"Neck")
  525. local Humanoid=waitForChild(sp,"Humanoid")
  526. local BodyColors=waitForChild(sp,"Body Colors")
  527. local pose="Standing"
  528. --local hitsound=waitForChild(Torso,"HitSound")
  529. --[[
  530. local sounds={
  531. waitForChild(Torso,"GroanSound"),
  532. waitForChild(Torso,"RawrSound")
  533. }
  534. --]]
  535. if healthregen then
  536. local regenscript=waitForChild(sp,"HealthRegenerationScript")
  537. regenscript.Disabled=false
  538. end
  539. Humanoid.WalkSpeed=wonderspeed
  540.  
  541. local toolAnim="None"
  542. local toolAnimTime=0
  543.  
  544. BodyColors.HeadColor=BrickColor.new("Grime")
  545. local randomcolor1=colors[math.random(1,#colors)]
  546. BodyColors.TorsoColor=BrickColor.new(randomcolor1)
  547. BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
  548. BodyColors.RightArmColor=BrickColor.new(randomcolor1)
  549. local randomcolor2=colors[math.random(1,#colors)]
  550. BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
  551. BodyColors.RightLegColor=BrickColor.new(randomcolor2)
  552.  
  553.  
  554. function onRunning(speed)
  555. if speed>0 then
  556. pose="Running"
  557. else
  558. pose="Standing"
  559. end
  560. end
  561. function onDied()
  562. pose="Dead"
  563. end
  564. function onJumping()
  565. pose="Jumping"
  566. end
  567. function onClimbing()
  568. pose="Climbing"
  569. end
  570. function onGettingUp()
  571. pose = "GettingUp"
  572. end
  573. function onFreeFall()
  574. pose = "FreeFall"
  575. end
  576. function onFallingDown()
  577. pose = "FallingDown"
  578. end
  579. function onSeated()
  580. pose = "Seated"
  581. end
  582. function onPlatformStanding()
  583. pose = "PlatformStanding"
  584. end
  585.  
  586. function moveJump()
  587. RightShoulder.MaxVelocity = 0.5
  588. LeftShoulder.MaxVelocity = 0.5
  589. RightShoulder.DesiredAngle=3.14
  590. LeftShoulder.DesiredAngle=-3.14
  591. RightHip.DesiredAngle=0
  592. LeftHip.DesiredAngle=0
  593. end
  594.  
  595. function moveFreeFall()
  596. RightShoulder.MaxVelocity = 0.5
  597. LeftShoulder.MaxVelocity =0.5
  598. RightShoulder.DesiredAngle=3.14
  599. LeftShoulder.DesiredAngle=-3.14
  600. RightHip.DesiredAngle=0
  601. LeftHip.DesiredAngle=0
  602. end
  603.  
  604. function moveSit()
  605. RightShoulder.MaxVelocity = 0.15
  606. LeftShoulder.MaxVelocity = 0.15
  607. RightShoulder.DesiredAngle=3.14 /2
  608. LeftShoulder.DesiredAngle=-3.14 /2
  609. RightHip.DesiredAngle=3.14 /2
  610. LeftHip.DesiredAngle=-3.14 /2
  611. end
  612.  
  613. function animate(time)
  614. local amplitude
  615. local frequency
  616. if (pose == "Jumping") then
  617. moveJump()
  618. return
  619. end
  620. if (pose == "FreeFall") then
  621. moveFreeFall()
  622. return
  623. end
  624. if (pose == "Seated") then
  625. moveSit()
  626. return
  627. end
  628. local climbFudge = 0
  629. if (pose == "Running") then
  630. RightShoulder.MaxVelocity = 0.15
  631. LeftShoulder.MaxVelocity = 0.15
  632. amplitude = 1
  633. frequency = 9
  634. elseif (pose == "Climbing") then
  635. RightShoulder.MaxVelocity = 0.5
  636. LeftShoulder.MaxVelocity = 0.5
  637. amplitude = 1
  638. frequency = 9
  639. climbFudge = 3.14
  640. else
  641. amplitude = 0.1
  642. frequency = 1
  643. end
  644. desiredAngle = amplitude * math.sin(time*frequency)
  645. if not chasing and frequency==9 then
  646. frequency=4
  647. end
  648. if chasing then
  649. RightShoulder.DesiredAngle=math.pi/2
  650. LeftShoulder.DesiredAngle=-math.pi/2
  651. RightHip.DesiredAngle=-desiredAngle*2
  652. LeftHip.DesiredAngle=-desiredAngle*2
  653. else
  654. RightShoulder.DesiredAngle=desiredAngle + climbFudge
  655. LeftShoulder.DesiredAngle=desiredAngle - climbFudge
  656. RightHip.DesiredAngle=-desiredAngle
  657. LeftHip.DesiredAngle=-desiredAngle
  658. end
  659. end
  660.  
  661.  
  662. function attack(time,attackpos)
  663. if time-lastattack>=1 then
  664. local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
  665. if hit and hit.Parent~=nil and hit.Parent.Name~=sp.Name then
  666. local h=hit.Parent:FindFirstChild("Humanoid")
  667. if h then
  668. local creator=sp:FindFirstChild("creator")
  669. if creator then
  670. if creator.Value~=nil then
  671. if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
  672. for i,oldtag in ipairs(h:GetChildren()) do
  673. if oldtag.Name=="creator" then
  674. oldtag:remove()
  675. end
  676. end
  677. creator:clone().Parent=h
  678. else
  679. return
  680. end
  681. end
  682. end
  683. h:TakeDamage(damage)
  684. --[[
  685. hitsound.Volume=.5+(.5*math.random())
  686. hitsound.Pitch=.5+math.random()
  687. hitsound:Play()
  688. --]]
  689. if RightShoulder and LeftShoulder then
  690. RightShoulder.CurrentAngle=0
  691. LeftShoulder.CurrentAngle=0
  692. end
  693. end
  694. end
  695. lastattack=time
  696. end
  697. end
  698.  
  699.  
  700. Humanoid.Died:connect(onDied)
  701. Humanoid.Running:connect(onRunning)
  702. Humanoid.Jumping:connect(onJumping)
  703. Humanoid.Climbing:connect(onClimbing)
  704. Humanoid.GettingUp:connect(onGettingUp)
  705. Humanoid.FreeFalling:connect(onFreeFall)
  706. Humanoid.FallingDown:connect(onFallingDown)
  707. Humanoid.Seated:connect(onSeated)
  708. Humanoid.PlatformStanding:connect(onPlatformStanding)
  709.  
  710.  
  711. function populatehumanoids(mdl)
  712. if mdl.ClassName=="Humanoid" then
  713. table.insert(humanoids,mdl)
  714. end
  715. for i2,mdl2 in ipairs(mdl:GetChildren()) do
  716. populatehumanoids(mdl2)
  717. end
  718. end
  719. --[[
  720. function playsound(time)
  721. nextsound=time+5+(math.random()*5)
  722. local randomsound=sounds[math.random(1,#sounds)]
  723. randomsound.Volume=.5+(.5*math.random())
  724. randomsound.Pitch=.5+(.5*math.random())
  725. randomsound:Play()
  726. end
  727. --]]
  728. while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
  729. local _,time=wait(1/3)
  730. humanoids={}
  731. populatehumanoids(game.Workspace)
  732. closesttarget=nil
  733. closestdist=sightrange
  734. local creator=sp:FindFirstChild("creator")
  735. for i,h in ipairs(humanoids) do
  736. if h and h.Parent~=nil then
  737. if h.Health>0 and h.Parent.Name~=sp.Name and h.Parent~=sp then
  738. local plr=game.Players:GetPlayerFromCharacter(h.Parent)
  739. if creator==nil or plr==nil or creator.Value~=plr then
  740. local t=h.Parent:FindFirstChild("Torso")
  741. if t~=nil then
  742. local dist=(t.Position-Torso.Position).magnitude
  743. if dist<closestdist then
  744. closestdist=dist
  745. closesttarget=t
  746. end
  747. end
  748. end
  749. end
  750. end
  751. end
  752. if closesttarget~=nil then
  753. if not chasing then
  754. --playsound(time)
  755. chasing=true
  756. Humanoid.WalkSpeed=runspeed
  757. end
  758. Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
  759. if math.random()<.5 then
  760. attack(time,closesttarget.Position)
  761. end
  762. else
  763. if chasing then
  764. chasing=false
  765. Humanoid.WalkSpeed=wonderspeed
  766. end
  767. if time>nextrandom then
  768. nextrandom=time+3+(math.random()*5)
  769. local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
  770. Humanoid:MoveTo(randompos,game.Workspace.Terrain)
  771. end
  772. end
  773. --[[
  774. if time>nextsound then
  775. playsound(time)
  776. end
  777. --]]
  778. if time>nextjump then
  779. nextjump=time+7+(math.random()*5)
  780. Humanoid.Jump=true
  781. end
  782. animate(time)
  783. end
  784.  
  785. wait(4)
  786. sp:remove() --Rest In Pizza
  787.  
  788. end,o15)
  789. end))
  790. mas.Parent = workspace
  791. mas:MakeJoints()
  792. local mas1 = mas:GetChildren()
  793. for i=1,#mas1 do
  794. mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  795. ypcall(function() mas1[i]:MakeJoints() end)
  796. end
  797. mas:Destroy()
  798. for i=1,#cors do
  799. coroutine.resume(cors[i])
  800. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement