Advertisement
YukkoAioi

purple sword

Oct 21st, 2017
1,935
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.98 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. BoolValue1 = Instance.new("BoolValue")
  21. BoolValue2 = Instance.new("BoolValue")
  22. BoolValue3 = Instance.new("BoolValue")
  23. Part4 = Instance.new("Part")
  24. SpecialMesh5 = Instance.new("SpecialMesh")
  25. Fire6 = Instance.new("Fire")
  26. PointLight7 = Instance.new("PointLight")
  27. PointLight8 = Instance.new("PointLight")
  28. Sparkles9 = Instance.new("Sparkles")
  29. Sound10 = Instance.new("Sound")
  30. Sound11 = Instance.new("Sound")
  31. Sound12 = Instance.new("Sound")
  32. Sound13 = Instance.new("Sound")
  33. Sound14 = Instance.new("Sound")
  34. Sound15 = Instance.new("Sound")
  35. Animation16 = Instance.new("Animation")
  36. Animation17 = Instance.new("Animation")
  37. Animation18 = Instance.new("Animation")
  38. Animation19 = Instance.new("Animation")
  39. Animation20 = Instance.new("Animation")
  40. Animation21 = Instance.new("Animation")
  41. Script22 = Instance.new("Script")
  42. LocalScript23 = Instance.new("LocalScript")
  43. LocalScript24 = Instance.new("LocalScript")
  44. LocalScript25 = Instance.new("LocalScript")
  45. Fire26 = Instance.new("Fire")
  46. Animation27 = Instance.new("Animation")
  47. Script28 = Instance.new("Script")
  48. Script29 = Instance.new("Script")
  49. Tool0.Name = "AzureSword"
  50. Tool0.Parent = mas
  51. Tool0.TextureId = "http://www.roblox.com/asset/?id=120894242"
  52. Tool0.GripPos = Vector3.new(0, -2.29999995, 0)
  53. Tool0.ToolTip = "Press E to summon, mi'lord."
  54. BoolValue1.Name = "PlayOverhead"
  55. BoolValue1.Parent = Tool0
  56. BoolValue1.Value = true
  57. BoolValue2.Name = "PlaySlash"
  58. BoolValue2.Parent = Tool0
  59. BoolValue2.Value = true
  60. BoolValue3.Name = "PlayThrust"
  61. BoolValue3.Parent = Tool0
  62. Part4.Name = "Handle"
  63. Part4.Parent = Tool0
  64. Part4.BrickColor = BrickColor.new("Really black")
  65. Part4.Reflectance = 1
  66. Part4.Rotation = Vector3.new(-115.290001, 58.3499985, 104.279999)
  67. Part4.FormFactor = Enum.FormFactor.Custom
  68. Part4.Size = Vector3.new(0.200000003, 5.99999857, 0.600000024)
  69. Part4.CFrame = CFrame.new(2.24991488, 5.06987381, 6.39291, -0.129414797, -0.508500516, 0.851280689, -0.224160001, 0.85127914, 0.474421859, -0.965921283, -0.129425809, -0.224153638)
  70. Part4.BottomSurface = Enum.SurfaceType.Smooth
  71. Part4.TopSurface = Enum.SurfaceType.Smooth
  72. Part4.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  73. Part4.Position = Vector3.new(2.24991488, 5.06987381, 6.39291)
  74. Part4.Orientation = Vector3.new(-28.3199997, 104.75, -14.75)
  75. Part4.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  76. SpecialMesh5.Parent = Part4
  77. SpecialMesh5.MeshId = "http://www.roblox.com/asset/?id=94840342"
  78. SpecialMesh5.Scale = Vector3.new(0.850000024, 0.850000024, 0.850000024)
  79. SpecialMesh5.TextureId = "http://www.roblox.com/asset/?id=120869251"
  80. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  81. SpecialMesh5.Scale = Vector3.new(0.850000024, 0.850000024, 0.850000024)
  82. Fire6.Parent = Part4
  83. Fire6.Size = 2
  84. Fire6.Color = Color3.new(0.666667, 0, 1)
  85. Fire6.Heat = 25
  86. Fire6.SecondaryColor = Color3.new(0.666667, 0.333333, 1)
  87. Fire6.Color = Color3.new(0.666667, 0, 1)
  88. PointLight7.Parent = Part4
  89. PointLight7.Color = Color3.new(0.666667, 0, 1)
  90. PointLight7.Brightness = 0.20000000298023
  91. PointLight7.Range = 30
  92. PointLight7.Shadows = true
  93. PointLight7.Color = Color3.new(0.666667, 0, 1)
  94. PointLight8.Parent = Part4
  95. PointLight8.Color = Color3.new(0.72549, 0.278431, 1)
  96. PointLight8.Brightness = 0.75
  97. PointLight8.Range = 15
  98. PointLight8.Shadows = true
  99. PointLight8.Color = Color3.new(0.72549, 0.278431, 1)
  100. Sparkles9.Parent = Part4
  101. Sparkles9.Color = Color3.new(0.388889, 0, 0.309804)
  102. Sparkles9.SparkleColor = Color3.new(0.219608, 0, 0.309804)
  103. Sparkles9.Color = Color3.new(0.388889, 0, 0.309804)
  104. Sound10.Name = "Gong"
  105. Sound10.Parent = Part4
  106. Sound10.Pitch = 0.75
  107. Sound10.SoundId = "http://www.roblox.com/asset/?id=11984254"
  108. Sound10.Volume = 1
  109. Sound11.Name = "HitSound"
  110. Sound11.Parent = Part4
  111. Sound11.Pitch = 0.80000001192093
  112. Sound11.SoundId = "http://www.roblox.com/Asset?ID=96667969"
  113. Sound11.Volume = 0.75
  114. Sound12.Name = "LungeSound"
  115. Sound12.Parent = Part4
  116. Sound12.Pitch = 0.80000001192093
  117. Sound12.SoundId = "rbxasset://sounds//swordlunge.wav"
  118. Sound12.Volume = 0.25
  119. Sound13.Name = "OverheadSound"
  120. Sound13.Parent = Part4
  121. Sound13.Pitch = 0.94999998807907
  122. Sound13.SoundId = "rbxasset://sounds//swordslash.wav"
  123. Sound14.Name = "SlashSound"
  124. Sound14.Parent = Part4
  125. Sound14.Pitch = 0.80000001192093
  126. Sound14.SoundId = "rbxasset://sounds//swordslash.wav"
  127. Sound14.Volume = 0.34999999403954
  128. Sound15.Name = "UnsheathSound"
  129. Sound15.Parent = Part4
  130. Sound15.SoundId = "http://www.roblox.com/asset/?id=134747889"
  131. Sound15.Volume = 0.75
  132. Animation16.Name = "IdleAnim3"
  133. Animation16.Parent = Tool0
  134. Animation16.AnimationId = "http://www.roblox.com/Asset?ID=94160581"
  135. Animation17.Name = "OverheadAnim2"
  136. Animation17.Parent = Tool0
  137. Animation17.AnimationId = "http://www.roblox.com/Asset?ID=94160738"
  138. Animation18.Name = "SlashAnim2"
  139. Animation18.Parent = Tool0
  140. Animation18.AnimationId = "http://www.roblox.com/Asset?ID=94161088"
  141. Animation19.Name = "ThrustAnim2"
  142. Animation19.Parent = Tool0
  143. Animation19.AnimationId = "http://www.roblox.com/Asset?ID=94161333"
  144. Animation20.Name = "UnequipAnim2"
  145. Animation20.Parent = Tool0
  146. Animation20.AnimationId = "http://www.roblox.com/Asset?ID=94095929"
  147. Animation21.Name = "EquipAnim5"
  148. Animation21.Parent = Tool0
  149. Animation21.AnimationId = "http://www.roblox.com/Asset?ID=94160581"
  150. Script22.Name = "SwordSwing"
  151. Script22.Parent = Tool0
  152. table.insert(cors,sandbox(Script22,function()
  153. r = game:service("RunService")
  154.  
  155. local damage = 0
  156.  
  157. sword = script.Parent.Handle
  158. Tool = script.Parent
  159.  
  160. local damages,values,sounds = {35,50,75},{Tool.PlaySlash,Tool.PlayThrust,Tool.PlayOverhead},{Tool.Handle.SlashSound,Tool.Handle.OverheadSound,Tool.Handle.LungeSound}
  161. local enabledToDamage = true
  162.  
  163. function blow(hit)
  164. if enabledToDamage == false then return end
  165. enabledToDamage = false
  166. if (hit.Parent == nil) then enabledToDamage = true return end -- happens when bullet hits sword
  167. local humanoid = hit.Parent:findFirstChild("Humanoid")
  168. local vCharacter = Tool.Parent
  169. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  170. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  171. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  172. -- final check, make sure sword is in-hand
  173. local right_arm = vCharacter:FindFirstChild("Right Arm")
  174. if (right_arm ~= nil) then
  175. local joint = right_arm:FindFirstChild("RightGrip")
  176. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  177. tagHumanoid(humanoid, vPlayer)
  178. humanoid:TakeDamage(damage)
  179. wait(1)
  180. untagHumanoid(humanoid)
  181. else
  182. enabledToDamage = true
  183. end
  184. else
  185. enabledToDamage = true
  186. end
  187. else
  188. enabledToDamage = true
  189. end
  190. end
  191.  
  192.  
  193. function tagHumanoid(humanoid, player)
  194. local creator_tag = Instance.new("ObjectValue")
  195. creator_tag.Value = player
  196. creator_tag.Name = "creator"
  197. creator_tag.Parent = humanoid
  198. end
  199.  
  200. function untagHumanoid(humanoid)
  201. if humanoid ~= nil then
  202. local tag = humanoid:findFirstChild("creator")
  203. if tag ~= nil then
  204. tag.Parent = nil
  205. end
  206. end
  207. end
  208.  
  209.  
  210. function attack()
  211. damage = slash_damage
  212. script.Parent.Handle.SlashSound:Play()
  213. script.Parent.PlaySlash.Value = not script.Parent.PlaySlash.Value
  214. end
  215.  
  216. function lunge()
  217. damage = lunge_damage
  218. script.Parent.Handle.LungeSound:Play()
  219. script.Parent.PlayOverhead.Value = not script.Parent.PlayOverhead.Value
  220. force = Instance.new("BodyVelocity")
  221. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  222. force.Parent = Tool.Parent.Torso
  223. wait(.5)
  224. force.Parent = nil
  225. wait(.5)
  226. damage = slash_damage
  227. end
  228.  
  229.  
  230. Tool.Enabled = true
  231. local last_attack = 0
  232. local status = 0
  233.  
  234. function onActivated()
  235. if not Tool.Enabled then
  236. return
  237. end
  238. Tool.Enabled = false
  239. local character = Tool.Parent;
  240. local humanoid = character.Humanoid
  241. if humanoid == nil then
  242. print("Humanoid not found")
  243. return
  244. end
  245. t = r.Stepped:wait()
  246. if (t - last_attack < 1.5) then
  247. if status == 3 then
  248. status = 0
  249. damage = 0
  250. else
  251. status = status + 1
  252. values[status].Value = not values[status].Value
  253. damage = damages[status]
  254. sounds[status]:Play()
  255. enabledToDamage = true
  256. wait(0.5)
  257. enabledToDamage = false
  258. end
  259. else
  260. status = 0
  261. damage = 0
  262. end
  263. last_attack = t
  264. Tool.Enabled = true
  265. end
  266.  
  267. function onEquipped()
  268. wait(1/3)
  269. Tool.Handle.UnsheathSound:Play()
  270. end
  271.  
  272. Tool.Equipped:connect(onEquipped)
  273. script.Parent.Activated:connect(onActivated)
  274. connection = sword.Touched:connect(blow)
  275. end))
  276. LocalScript23.Name = "AnimationScript"
  277. LocalScript23.Parent = Tool0
  278. table.insert(cors,sandbox(LocalScript23,function()
  279. -- Waits for the child of the specified parent
  280. local function WaitForChild(parent, childName)
  281. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  282. return parent[childName]
  283. end
  284.  
  285. local Tool = script.Parent
  286.  
  287. local Animations = {}
  288. local MyHumanoid
  289. local MyCharacter
  290.  
  291.  
  292. local function PlayAnimation(animationName)
  293. if Animations[animationName] then
  294. Animations[animationName]:Play()
  295. end
  296. end
  297.  
  298. local function StopAnimation(animationName)
  299. if Animations[animationName] then
  300. Animations[animationName]:Stop()
  301. end
  302. end
  303.  
  304.  
  305. function OnEquipped(mouse)
  306. MyCharacter = Tool.Parent
  307. MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
  308. if MyHumanoid then
  309. Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
  310. Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
  311. Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2'))
  312. Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2'))
  313. Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2'))
  314. Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2'))
  315. end
  316. PlayAnimation('EquipAnim')
  317. PlayAnimation('IdleAnim')
  318. end
  319.  
  320. function OnUnequipped()
  321. for animName, _ in pairs(Animations) do
  322. StopAnimation(animName)
  323. end
  324. end
  325.  
  326. Tool.Equipped:connect(OnEquipped)
  327. Tool.Unequipped:connect(OnUnequipped)
  328.  
  329. WaitForChild(Tool, 'PlaySlash').Changed:connect(
  330. function (value)
  331. --if value then
  332. PlayAnimation('SlashAnim')
  333. --else
  334. -- StopAnimation('SlashAnim')
  335. --end
  336. end)
  337.  
  338. WaitForChild(Tool, 'PlayThrust').Changed:connect(
  339. function (value)
  340. --if value then
  341. PlayAnimation('ThrustAnim')
  342. --else
  343. -- StopAnimation('ThrustAnim')
  344. --end
  345. end)
  346.  
  347. WaitForChild(Tool, 'PlayOverhead').Changed:connect(
  348. function (value)
  349. --if value then
  350. PlayAnimation('OverheadAnim')
  351. --else
  352. -- StopAnimation('OverheadAnim')
  353. --end
  354. end)
  355.  
  356. end))
  357. LocalScript24.Name = "Local Gui"
  358. LocalScript24.Parent = Tool0
  359. table.insert(cors,sandbox(LocalScript24,function()
  360. local Tool = script.Parent;
  361.  
  362. enabled = true
  363. function onButton1Down(mouse)
  364. if not enabled then
  365. return
  366. end
  367.  
  368. enabled = false
  369. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  370. while not Tool.Enabled do
  371. wait(0.05)
  372. end
  373.  
  374. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  375. enabled = true
  376.  
  377. end
  378.  
  379. function onEquippedLocal(mouse)
  380.  
  381. if mouse == nil then
  382. print("Mouse not found")
  383. return
  384. end
  385.  
  386. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  387. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  388. end
  389.  
  390.  
  391. Tool.Equipped:connect(onEquippedLocal)
  392.  
  393. end))
  394. LocalScript25.Name = "RaiseSkeletons"
  395. LocalScript25.Parent = Tool0
  396. table.insert(cors,sandbox(LocalScript25,function()
  397. -----------------
  398. --| Constants |--
  399. -----------------
  400.  
  401. local SPAWN_RADIUS = 8 -- Studs
  402.  
  403. local SUMMON_COOLDOWN = 16
  404.  
  405. local SKELETON_ASSET_ID = 132805224
  406.  
  407. local SKELETON_DURATION = 60
  408.  
  409. --------------------
  410. --| WaitForChild |--
  411. --------------------
  412.  
  413. -- Waits for parent.child to exist, then returns it
  414. local function WaitForChild(parent, childName)
  415. assert(parent, "ERROR: WaitForChild: parent is nil")
  416. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  417. return parent[childName]
  418. end
  419.  
  420. -----------------
  421. --| Variables |--
  422. -----------------
  423.  
  424. local InsertService = Game:GetService('InsertService')
  425. local DebrisService = Game:GetService('Debris')
  426. local PlayersService = Game:GetService('Players')
  427.  
  428. local Tool = script.Parent
  429. local ToolHandle = Tool.Handle
  430.  
  431. local MyPlayer = PlayersService.LocalPlayer
  432.  
  433. local SkeletonScript = WaitForChild(script, 'SkeletonScript')
  434. local Fire = WaitForChild(script, 'Fire')
  435. local SummonAnimation = WaitForChild(script, 'Summon')
  436.  
  437. local GongSound = WaitForChild(ToolHandle, 'Gong')
  438.  
  439. local MyModel = nil
  440. local Skeleton = nil
  441. local LastSummonTime = 0
  442. local SummonTrack = nil
  443.  
  444. -----------------
  445. --| Functions |--
  446. -----------------
  447.  
  448. local function MakeSkeleton()
  449. Skeleton = InsertService:LoadAsset(SKELETON_ASSET_ID):GetChildren()[1]
  450. if Skeleton then
  451. local head = Skeleton:FindFirstChild('Head')
  452. if head then
  453. head.Transparency = 1
  454. end
  455.  
  456. local skeletonScriptClone = SkeletonScript:Clone()
  457. skeletonScriptClone.Parent = Skeleton
  458. skeletonScriptClone.Disabled = false
  459.  
  460. local creatorTag = Instance.new('ObjectValue')
  461. creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  462. creatorTag.Value = MyPlayer
  463. local iconTag = Instance.new('StringValue', creatorTag)
  464. iconTag.Name = 'icon'
  465. iconTag.Value = Tool.TextureId
  466. creatorTag.Parent = Skeleton
  467. end
  468. end
  469.  
  470. local function SpawnSkeleton(spawnPosition)
  471. if Skeleton then
  472. -- Hellfire
  473. local firePart = Instance.new('Part')
  474. firePart.Name = 'Effect'
  475. firePart.Transparency = 1
  476. firePart.FormFactor = Enum.FormFactor.Custom
  477. firePart.Size = Vector3.new()
  478. firePart.Anchored = true
  479. firePart.CanCollide = false
  480. firePart.CFrame = CFrame.new(spawnPosition - Vector3.new(0, 4, 0))
  481. local fireClone = Fire:Clone()
  482. fireClone.Parent = firePart
  483. Delay(0.5, function()
  484. if fireClone then
  485. fireClone.Enabled = false
  486. end
  487. end)
  488. DebrisService:AddItem(firePart, 3)
  489. firePart.Parent = Workspace
  490.  
  491. -- Spawn
  492. local skeletonClone = Skeleton:Clone()
  493. DebrisService:AddItem(skeletonClone, SKELETON_DURATION)
  494. skeletonClone.Parent = Workspace
  495. skeletonClone:MoveTo(spawnPosition) --NOTE: Model must be in Workspace
  496.  
  497. -- Rise!
  498. local torso = skeletonClone:FindFirstChild('Torso')
  499. if torso then
  500. torso.CFrame = torso.CFrame - Vector3.new(0, 4.5, 0)
  501. for i = 0, 4.5, 0.45 do
  502. torso.CFrame = torso.CFrame + Vector3.new(0, i, 0)
  503. wait(1/30)
  504. end
  505. end
  506. end
  507. end
  508.  
  509. local function RaiseSkeletons()
  510. if not Skeleton then -- Try again
  511. MakeSkeleton()
  512. end
  513. for theta = -135, -45, 45 do
  514. SpawnSkeleton(MyModel.Torso.CFrame:pointToWorldSpace(Vector3.new(math.cos(theta), 0, math.sin(theta)) * SPAWN_RADIUS))
  515. end
  516. end
  517.  
  518. --NOTE: Ugly!
  519. local function OnKeyDown(key)
  520. key = string.lower(key)
  521. if key == 'e' then
  522. local now = time()
  523. if now > LastSummonTime + SUMMON_COOLDOWN then
  524. LastSummonTime = now
  525. local humanoid = MyModel:FindFirstChild('Humanoid')
  526. if humanoid then
  527. humanoid.WalkSpeed = 0
  528. end
  529. Spawn(function()
  530. for i = 1, 3 do
  531. if GongSound then GongSound:Play() end
  532. wait(1.5)
  533. end
  534. end)
  535. if SummonTrack then
  536. SummonTrack:Play()
  537. wait(3.125)
  538. end
  539. RaiseSkeletons()
  540. wait(1)
  541. if humanoid then
  542. humanoid.WalkSpeed = 18
  543. end
  544. end
  545. end
  546. end
  547.  
  548. local function OnEquipped(mouse)
  549. MyModel = Tool.Parent
  550. mouse.KeyDown:connect(OnKeyDown)
  551.  
  552. local humanoid = MyModel:FindFirstChild('Humanoid')
  553. if humanoid then -- Preload animations
  554. SummonTrack = humanoid:LoadAnimation(SummonAnimation)
  555. end
  556. end
  557.  
  558. local function OnUnequipped()
  559. if SummonTrack then SummonTrack:Stop() end
  560. end
  561.  
  562. --------------------
  563. --| Script Logic |--
  564. --------------------
  565.  
  566. MakeSkeleton()
  567. Tool.Equipped:connect(OnEquipped)
  568. Tool.Unequipped:connect(OnUnequipped)
  569.  
  570. end))
  571. Fire26.Parent = LocalScript25
  572. Fire26.Size = 10
  573. Fire26.Color = Color3.new(0.666667, 0, 1)
  574. Fire26.Heat = 25
  575. Fire26.SecondaryColor = Color3.new(0.666667, 0.333333, 1)
  576. Fire26.Color = Color3.new(0.666667, 0, 1)
  577. Animation27.Name = "Summon"
  578. Animation27.Parent = LocalScript25
  579. Animation27.AnimationId = "http://www.roblox.com/Asset?ID=93693205"
  580. Script28.Name = "SkeletonScript"
  581. Script28.Parent = LocalScript25
  582. Script28.Disabled = true
  583. table.insert(cors,sandbox(Script28,function()
  584. --Made by Stickmasterluke
  585.  
  586. --Zombie artificial stupidity script
  587. --(Modified for skeletons)
  588.  
  589. sp=script.Parent
  590. lastattack=0
  591. nextrandom=0
  592. --nextsound=0
  593. nextjump=0
  594. chasing=false
  595.  
  596. variance=4
  597.  
  598. damage=26
  599. attackrange=5
  600. sightrange=100
  601. runspeed=26
  602. wonderspeed=16
  603. healthregen=true
  604. colors={"Really black"}
  605.  
  606. function raycast(spos,vec,currentdist)
  607. local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
  608. if hit2~=nil and pos2 then
  609. if hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" then
  610. local currentdist=currentdist-(pos2-spos).magnitude
  611. return raycast(pos2,vec,currentdist)
  612. end
  613. end
  614. return hit2,pos2
  615. end
  616.  
  617. function waitForChild(parent,childName)
  618. local child=parent:findFirstChild(childName)
  619. if child then return child end
  620. while true do
  621. child=parent.ChildAdded:wait()
  622. if child.Name==childName then return child end
  623. end
  624. end
  625.  
  626. -- ANIMATION
  627.  
  628. -- declarations
  629.  
  630. local Torso=waitForChild(sp,"Torso")
  631. local Head=waitForChild(sp,"Head")
  632. local RightShoulder=waitForChild(Torso,"Right Shoulder")
  633. local LeftShoulder=waitForChild(Torso,"Left Shoulder")
  634. local RightHip=waitForChild(Torso,"Right Hip")
  635. local LeftHip=waitForChild(Torso,"Left Hip")
  636. local Neck=waitForChild(Torso,"Neck")
  637. local Humanoid=waitForChild(sp,"Humanoid")
  638. local BodyColors=waitForChild(sp,"Body Colors")
  639. local pose="Standing"
  640. --local hitsound=waitForChild(Torso,"HitSound")
  641. --[[
  642. local sounds={
  643. waitForChild(Torso,"GroanSound"),
  644. waitForChild(Torso,"RawrSound")
  645. }
  646. --]]
  647. if healthregen then
  648. local regenscript=waitForChild(sp,"HealthRegenerationScript")
  649. regenscript.Disabled=false
  650. end
  651. Humanoid.WalkSpeed=wonderspeed
  652.  
  653. local toolAnim="None"
  654. local toolAnimTime=0
  655.  
  656. BodyColors.HeadColor=BrickColor.new("Grime")
  657. local randomcolor1=colors[math.random(1,#colors)]
  658. BodyColors.TorsoColor=BrickColor.new(randomcolor1)
  659. BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
  660. BodyColors.RightArmColor=BrickColor.new(randomcolor1)
  661. local randomcolor2=colors[math.random(1,#colors)]
  662. BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
  663. BodyColors.RightLegColor=BrickColor.new(randomcolor2)
  664.  
  665.  
  666. function onRunning(speed)
  667. if speed>0 then
  668. pose="Running"
  669. else
  670. pose="Standing"
  671. end
  672. end
  673. function onDied()
  674. pose="Dead"
  675. end
  676. function onJumping()
  677. pose="Jumping"
  678. end
  679. function onClimbing()
  680. pose="Climbing"
  681. end
  682. function onGettingUp()
  683. pose = "GettingUp"
  684. end
  685. function onFreeFall()
  686. pose = "FreeFall"
  687. end
  688. function onFallingDown()
  689. pose = "FallingDown"
  690. end
  691. function onSeated()
  692. pose = "Seated"
  693. end
  694. function onPlatformStanding()
  695. pose = "PlatformStanding"
  696. end
  697.  
  698. function moveJump()
  699. RightShoulder.MaxVelocity = 0.5
  700. LeftShoulder.MaxVelocity = 0.5
  701. RightShoulder.DesiredAngle=3.14
  702. LeftShoulder.DesiredAngle=-3.14
  703. RightHip.DesiredAngle=0
  704. LeftHip.DesiredAngle=0
  705. end
  706.  
  707. function moveFreeFall()
  708. RightShoulder.MaxVelocity = 0.5
  709. LeftShoulder.MaxVelocity =0.5
  710. RightShoulder.DesiredAngle=3.14
  711. LeftShoulder.DesiredAngle=-3.14
  712. RightHip.DesiredAngle=0
  713. LeftHip.DesiredAngle=0
  714. end
  715.  
  716. function moveSit()
  717. RightShoulder.MaxVelocity = 0.15
  718. LeftShoulder.MaxVelocity = 0.15
  719. RightShoulder.DesiredAngle=3.14 /2
  720. LeftShoulder.DesiredAngle=-3.14 /2
  721. RightHip.DesiredAngle=3.14 /2
  722. LeftHip.DesiredAngle=-3.14 /2
  723. end
  724.  
  725. function animate(time)
  726. local amplitude
  727. local frequency
  728. if (pose == "Jumping") then
  729. moveJump()
  730. return
  731. end
  732. if (pose == "FreeFall") then
  733. moveFreeFall()
  734. return
  735. end
  736. if (pose == "Seated") then
  737. moveSit()
  738. return
  739. end
  740. local climbFudge = 0
  741. if (pose == "Running") then
  742. RightShoulder.MaxVelocity = 0.15
  743. LeftShoulder.MaxVelocity = 0.15
  744. amplitude = 1
  745. frequency = 9
  746. elseif (pose == "Climbing") then
  747. RightShoulder.MaxVelocity = 0.5
  748. LeftShoulder.MaxVelocity = 0.5
  749. amplitude = 1
  750. frequency = 9
  751. climbFudge = 3.14
  752. else
  753. amplitude = 0.1
  754. frequency = 1
  755. end
  756. desiredAngle = amplitude * math.sin(time*frequency)
  757. if not chasing and frequency==9 then
  758. frequency=4
  759. end
  760. if chasing then
  761. RightShoulder.DesiredAngle=math.pi/2
  762. LeftShoulder.DesiredAngle=-math.pi/2
  763. RightHip.DesiredAngle=-desiredAngle*2
  764. LeftHip.DesiredAngle=-desiredAngle*2
  765. else
  766. RightShoulder.DesiredAngle=desiredAngle + climbFudge
  767. LeftShoulder.DesiredAngle=desiredAngle - climbFudge
  768. RightHip.DesiredAngle=-desiredAngle
  769. LeftHip.DesiredAngle=-desiredAngle
  770. end
  771. end
  772.  
  773.  
  774. function attack(time,attackpos)
  775. if time-lastattack>=1 then
  776. local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
  777. if hit and hit.Parent~=nil and hit.Parent.Name~=sp.Name then
  778. local h=hit.Parent:FindFirstChild("Humanoid")
  779. if h then
  780. local creator=sp:FindFirstChild("creator")
  781. if creator then
  782. if creator.Value~=nil then
  783. if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
  784. for i,oldtag in ipairs(h:GetChildren()) do
  785. if oldtag.Name=="creator" then
  786. oldtag:remove()
  787. end
  788. end
  789. creator:clone().Parent=h
  790. else
  791. return
  792. end
  793. end
  794. end
  795. h:TakeDamage(damage)
  796. --[[
  797. hitsound.Volume=.5+(.5*math.random())
  798. hitsound.Pitch=.5+math.random()
  799. hitsound:Play()
  800. --]]
  801. if RightShoulder and LeftShoulder then
  802. RightShoulder.CurrentAngle=0
  803. LeftShoulder.CurrentAngle=0
  804. end
  805. end
  806. end
  807. lastattack=time
  808. end
  809. end
  810.  
  811.  
  812. Humanoid.Died:connect(onDied)
  813. Humanoid.Running:connect(onRunning)
  814. Humanoid.Jumping:connect(onJumping)
  815. Humanoid.Climbing:connect(onClimbing)
  816. Humanoid.GettingUp:connect(onGettingUp)
  817. Humanoid.FreeFalling:connect(onFreeFall)
  818. Humanoid.FallingDown:connect(onFallingDown)
  819. Humanoid.Seated:connect(onSeated)
  820. Humanoid.PlatformStanding:connect(onPlatformStanding)
  821.  
  822.  
  823. function populatehumanoids(mdl)
  824. if mdl.ClassName=="Humanoid" then
  825. table.insert(humanoids,mdl)
  826. end
  827. for i2,mdl2 in ipairs(mdl:GetChildren()) do
  828. populatehumanoids(mdl2)
  829. end
  830. end
  831. --[[
  832. function playsound(time)
  833. nextsound=time+5+(math.random()*5)
  834. local randomsound=sounds[math.random(1,#sounds)]
  835. randomsound.Volume=.5+(.5*math.random())
  836. randomsound.Pitch=.5+(.5*math.random())
  837. randomsound:Play()
  838. end
  839. --]]
  840. 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
  841. local _,time=wait(1/3)
  842. humanoids={}
  843. populatehumanoids(game.Workspace)
  844. closesttarget=nil
  845. closestdist=sightrange
  846. local creator=sp:FindFirstChild("creator")
  847. for i,h in ipairs(humanoids) do
  848. if h and h.Parent~=nil then
  849. if h.Health>0 and h.Parent.Name~=sp.Name and h.Parent~=sp then
  850. local plr=game.Players:GetPlayerFromCharacter(h.Parent)
  851. if creator==nil or plr==nil or creator.Value~=plr then
  852. local t=h.Parent:FindFirstChild("Torso")
  853. if t~=nil then
  854. local dist=(t.Position-Torso.Position).magnitude
  855. if dist<closestdist then
  856. closestdist=dist
  857. closesttarget=t
  858. end
  859. end
  860. end
  861. end
  862. end
  863. end
  864. if closesttarget~=nil then
  865. if not chasing then
  866. --playsound(time)
  867. chasing=true
  868. Humanoid.WalkSpeed=runspeed
  869. end
  870. Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
  871. if math.random()<.5 then
  872. attack(time,closesttarget.Position)
  873. end
  874. else
  875. if chasing then
  876. chasing=false
  877. Humanoid.WalkSpeed=wonderspeed
  878. end
  879. if time>nextrandom then
  880. nextrandom=time+5+(math.random()*5)
  881. local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(math.random(),math.random(),math.random()))*40)
  882. Humanoid:MoveTo(randompos,game.Workspace.Terrain)
  883. end
  884. end
  885. --[[
  886. if time>nextsound then
  887. playsound(time)
  888. end
  889. --]]
  890. if time>nextjump then
  891. nextjump=time+7+(math.random()*5)
  892. Humanoid.Jump=true
  893. end
  894. animate(time)
  895. end
  896.  
  897. wait(4)
  898. sp:remove() --Rest In Pizza
  899.  
  900. end))
  901. Script29.Name = "SwordScript"
  902. Script29.Parent = Tool0
  903. table.insert(cors,sandbox(Script29,function()
  904. -- Copied from Grimgold Periastron Beta
  905.  
  906. local Tool = script.Parent
  907. local Sword = Tool.Handle
  908.  
  909. local vCharacter
  910. local myTorso
  911. local myHumanoid
  912.  
  913. local equipped = false
  914.  
  915. local debris = game:GetService("Debris")
  916.  
  917. function tagHumanoid(humanoid, player)
  918. if humanoid then
  919. local creatorTag = Instance.new("ObjectValue")
  920. creatorTag.Value = player
  921. creatorTag.Name = "creator"
  922. creatorTag.Parent = humanoid
  923. debris:AddItem(creatorTag, 1)
  924. end
  925. end
  926.  
  927. function cut(hit)
  928. local humanoid
  929. local vPlayer
  930. if hit and hit.Parent and myHumanoid then
  931. if hit.Parent.className == "Hat" then
  932. humanoid = hit.Parent.Parent:FindFirstChild("Humanoid")
  933. else
  934. humanoid = hit.Parent:FindFirstChild("Humanoid")
  935. end
  936. vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  937. if humanoid ~= nil and humanoid ~= myHumanoid then
  938. tagHumanoid(humanoid, vPlayer)
  939. humanoid:TakeDamage(7.5)
  940. end
  941. end
  942. end
  943.  
  944. function onEquipped()
  945. vCharacter = Tool.Parent
  946. myTorso = vCharacter:FindFirstChild("Torso")
  947. myHumanoid = vCharacter:FindFirstChild("Humanoid")
  948. end
  949.  
  950. Tool.Equipped:connect(onEquipped)
  951.  
  952. Sword.Touched:connect(cut)
  953.  
  954. -------- OMG HAX
  955.  
  956. r = game:service("RunService")
  957.  
  958.  
  959. local damage = 5
  960.  
  961. local slash_damage = 10
  962. local lunge_damage = 10
  963.  
  964.  
  965. sword = script.Parent.Handle
  966. Tool = script.Parent
  967.  
  968. local explozion =Instance.new("Explosion")
  969. local SlashSound = Instance.new("Sound")
  970. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  971. SlashSound.Parent = sword
  972. SlashSound.Volume = .7
  973.  
  974. local LungeSound = Instance.new("Sound")
  975. LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
  976. LungeSound.Parent = sword
  977. LungeSound.Volume = .6
  978.  
  979. local UnsheathSound = Instance.new("Sound")
  980. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  981. UnsheathSound.Parent = sword
  982. UnsheathSound.Volume = 1
  983.  
  984.  
  985. function blow(hit)
  986. local humanoid = hit.Parent:findFirstChild("Humanoid")
  987. local vCharacter = Tool.Parent
  988. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  989. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  990. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  991. -- final check, make sure sword is in-hand
  992.  
  993. local right_arm = vCharacter:FindFirstChild("Right Arm")
  994. if (right_arm ~= nil) then
  995. local joint = right_arm:FindFirstChild("RightGrip")
  996. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  997. tagHumanoid(humanoid, vPlayer)
  998. humanoid:TakeDamage(damage)
  999. wait(1)
  1000. untagHumanoid(humanoid)
  1001. end
  1002. end
  1003.  
  1004.  
  1005. end
  1006. end
  1007.  
  1008.  
  1009. function tagHumanoid(humanoid, player)
  1010. local creator_tag = Instance.new("ObjectValue")
  1011. creator_tag.Value = player
  1012. creator_tag.Name = "creator"
  1013. creator_tag.Parent = humanoid
  1014. end
  1015.  
  1016. function untagHumanoid(humanoid)
  1017. if humanoid ~= nil then
  1018. local tag = humanoid:findFirstChild("creator")
  1019. if tag ~= nil then
  1020. tag.Parent = nil
  1021. end
  1022. end
  1023. end
  1024.  
  1025.  
  1026. function attack()
  1027. damage = slash_damage
  1028. SlashSound:play()
  1029. local anim = Instance.new("StringValue")
  1030. anim.Name = "toolanim"
  1031. anim.Value = "Slash"
  1032. anim.Parent = Tool
  1033. end
  1034.  
  1035. function lunge()
  1036. damage = lunge_damage
  1037.  
  1038. LungeSound:play()
  1039.  
  1040. local anim = Instance.new("StringValue")
  1041. anim.Name = "toolanim"
  1042. anim.Value = "Lunge"
  1043. anim.Parent = Tool
  1044.  
  1045.  
  1046. force = Instance.new("BodyVelocity")
  1047. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  1048. force.Parent = Tool.Parent.Torso
  1049. wait(.25)
  1050. swordOut()
  1051. wait(.25)
  1052. force.Parent = nil
  1053. wait(.5)
  1054. swordUp()
  1055.  
  1056. damage = slash_damage
  1057. end
  1058.  
  1059. function swordUp()
  1060. Tool.GripForward = Vector3.new(-1,0,0)
  1061. Tool.GripRight = Vector3.new(0,1,0)
  1062. Tool.GripUp = Vector3.new(0,0,1)
  1063. end
  1064.  
  1065. function swordOut()
  1066. Tool.GripForward = Vector3.new(0,0,1)
  1067. Tool.GripRight = Vector3.new(0,-1,0)
  1068. Tool.GripUp = Vector3.new(-1,0,0)
  1069. end
  1070.  
  1071. function swordAcross()
  1072. -- parry
  1073. end
  1074.  
  1075.  
  1076. Tool.Enabled = true
  1077. local last_attack = 0
  1078. function onActivated()
  1079.  
  1080. if not Tool.Enabled then
  1081. return
  1082. end
  1083.  
  1084. Tool.Enabled = false
  1085.  
  1086. local character = Tool.Parent;
  1087. local humanoid = character.Humanoid
  1088. if humanoid == nil then
  1089. print("Humanoid not found")
  1090. return
  1091. end
  1092.  
  1093. t = r.Stepped:wait()
  1094.  
  1095. if (t - last_attack < .2) then
  1096. lunge()
  1097. else
  1098. attack()
  1099. end
  1100.  
  1101. last_attack = t
  1102.  
  1103. --wait(.5)
  1104.  
  1105. Tool.Enabled = true
  1106. end
  1107.  
  1108.  
  1109. function onEquipped()
  1110. UnsheathSound:play()
  1111. end
  1112.  
  1113.  
  1114. script.Parent.Activated:connect(onActivated)
  1115. script.Parent.Equipped:connect(onEquipped)
  1116.  
  1117.  
  1118. connection = sword.Touched:connect(blow)
  1119. end))
  1120. for i,v in pairs(mas:GetChildren()) do
  1121. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1122. pcall(function() v:MakeJoints() end)
  1123. end
  1124. mas:Destroy()
  1125. for i,v in pairs(cors) do
  1126. spawn(function()
  1127. pcall(v)
  1128. end)
  1129. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement