kilcrafter

Hammer

Sep 6th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ------------------------------------------------------------------------
  2. -- Made by Cronizete --
  3. ------------------------------------------------------------------------
  4.  
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. --print("FE Compatibility code by Mokiros")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. ------------------------------------------------------------------------
  88. -- Things --
  89. ------------------------------------------------------------------------
  90.  
  91. plr = owner
  92. char = plr.Character
  93. lleg,rleg,larm,rarm,hed = char["Left Leg"],char["Right Leg"],char["Left Arm"],char["Right Arm"],char["Head"]
  94. rutprt,torso = char.HumanoidRootPart,char.Torso
  95. otheranims,swimming,hum,stopanim,cooldown = false,false,char:FindFirstChildOfClass'Humanoid',false,false
  96. TweenService = game:GetService("TweenService")
  97. stopanim2 = false -- larm
  98. stopanim3 = false -- head
  99.  
  100. hammer = Instance.new('Part', char)
  101. hammer.Name = "Hammer"
  102. hammer.CanCollide = true
  103. hammer.Position = char.Head.Position
  104. hammer.Size = Vector3.new(1.71, 1.31, 3.2)
  105. hammer.Locked = true
  106. mesh = Instance.new('SpecialMesh', hammer)
  107. mesh.MeshId = "rbxassetid://12592754"
  108. mesh.TextureId = "rbxassetid://12592745"
  109. mesh.Scale = Vector3.new(1.05, 1.05, 1.05)
  110.  
  111. fx = Instance.new('Part', char)
  112. fx.Anchored = false
  113. fx.CanCollide = false
  114. fx.Transparency = 1
  115. fx.Size = Vector3.new(1.77, 0.85, 1.05)
  116. weld = Instance.new('Weld', fx)
  117. weld.Part0 = fx
  118. weld.Part1 = hammer
  119. weld.C0 = CFrame.new(0, 0, -1.2)
  120.  
  121. func = hammer.Touched:connect(function(hit)
  122. if not hit.Parent:FindFirstChildOfClass'Humanoid' then
  123. wait(1)
  124. hammer.Anchored = true
  125. func:disconnect()
  126. end
  127. end)
  128.  
  129. function gettorso(a)
  130. return a:FindFirstChild'Torso' or a:FindFirstChild'UpperTorso' or a:FindFirstChild'LowerTorso' or a:FindFirstChild'HumanoidRootPart'
  131. end
  132.  
  133. ------------------------------------------------------------------------
  134. -- Animate Stuff --
  135. ------------------------------------------------------------------------
  136. char.Animate.Disabled=true
  137. local fldb={['w']=false,['a']=false,['s']=false,['d']=false}
  138. local RunSpeed=30
  139.  
  140. local WlkSpeed=16
  141. local SwimSpeed=14
  142. local SwimDashSpeed=28
  143. local anim = "Idling"
  144. local lastanim = "Idling"
  145. local val = 0
  146. local syne = 0
  147. local num = 0
  148. local runtime = 0
  149. local pseudohead=hed:Clone()
  150. for i,x in pairs(pseudohead:GetChildren()) do if not x.ClassName:find('Mesh') then x:Destroy() end end
  151. pseudohead.Name='PseudoHead'
  152. pseudohead.Parent=char.Head
  153. local pseudoweld=Instance.new('Weld',torso)
  154. pseudoweld.Part0=hed
  155. pseudoweld.Name='PseudoHedWld'
  156. pseudoweld.Part1=pseudohead
  157. hed.Transparency=1
  158.  
  159. coroutine.wrap(function() for i,x in pairs(hed:GetChildren()) do if x:IsA('Sound') then x:Destroy() end end end)()
  160.  
  161. function Lerp(a, b, i)
  162. local com1 = {a.X, a.Y, a.Z, a:toEulerAnglesXYZ()}
  163. local com2 = {b.X, b.Y, b.Z, b:toEulerAnglesXYZ()}
  164. local calx = com1[1] + (com2[1] - com1[1]) * i
  165. local caly = com1[2] + (com2[2] - com1[2]) * i
  166. local calz = com1[3] + (com2[3] - com1[3]) * i
  167. local cala = com1[4] + (com2[4] - com1[4]) * i
  168. local calb = com1[5] + (com2[5] - com1[5]) * i
  169. local calc = com1[6] + (com2[6] - com1[6]) * i
  170. return CFrame.new(calx, caly, calz) * CFrame.Angles(cala, calb, calc)
  171. end
  172.  
  173. function TwnSingleNumber(s,f,m)
  174. local wot=s+(f-s)*m
  175. return wot
  176. end
  177.  
  178. function TwnVector3(q,w,e)
  179. local begin={q.x,q.y,q.z}
  180. local ending={w.x,w.y,w.z}
  181. local bgx=begin[1]+(ending[1]-begin[1])*e
  182. local bgy=begin[2]+(ending[2]-begin[2])*e
  183. local bgz=begin[3]+(ending[3]-begin[3])*e
  184. return Vector3.new(bgx,bgy,bgz)
  185. end
  186.  
  187. newWeld = function(wld, wp0, wp1, wc0x, wc0y, wc0z)
  188. wld = Instance.new("Weld", wp1)
  189. wld.Part0 = wp0
  190. wld.Part1 = wp1
  191. wld.C0 = CFrame.new(wc0x, wc0y, wc0z)
  192. end
  193.  
  194. local angles = CFrame.Angles
  195. function clerp(a, b, t)
  196. return a:lerp(b, t)
  197. end
  198.  
  199. newWeld(law, torso, larm, -1.5, 0.5, 0)
  200. newWeld(raw, torso, rarm, 1.5, 0.5, 0)
  201. newWeld(llw, torso, lleg, -.5, -2, 0)
  202. newWeld(rlw, torso, rleg, .5, -2, 0)
  203. newWeld(hw, torso, hed, 0, 1.5, 0)
  204. local rutwald=Instance.new('Weld',rutprt)
  205. rutwald.Part0=rutprt
  206. rutwald.Part1=torso
  207. rutprt.Weld.C1=CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),math.rad(0),0)
  208. larm.Weld.C1 = CFrame.new(0, 0.5, 0)*CFrame.Angles(math.rad(0),0,0)
  209. rarm.Weld.C1 = CFrame.new(0, 0.5, 0)*CFrame.Angles(math.rad(0),0,0)
  210. rleg.Weld.C1=CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),0,0)
  211. lleg.Weld.C1=CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),0,0)
  212.  
  213. ------------------------------------------------------------------------
  214. -- idk --
  215. ------------------------------------------------------------------------
  216.  
  217. wind = Instance.new('Sound', hammer)
  218. wind.SoundId = "rbxassetid://866649671"
  219. wind.PlaybackSpeed = 1.5
  220. wind.Volume = 1
  221. wind.Looped = true
  222.  
  223. grab = Instance.new('Sound', rarm)
  224. grab.SoundId = "rbxassetid://1296135936"
  225. grab.Volume = 1
  226. grab.Looped = false
  227.  
  228. drop = Instance.new('Sound', hammer)
  229. drop.SoundId = "rbxassetid://873196972"
  230. drop.Volume = 1
  231. drop.Looped = false
  232.  
  233. ghit = Instance.new('Sound', hammer)
  234. ghit.SoundId = "rbxassetid://873196789"
  235. ghit.Volume = 5
  236. ghit.Looped = false
  237.  
  238. gyro = Instance.new('BodyGyro', hammer)
  239. gyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  240. gyro.CFrame = CFrame.Angles(math.rad(90), 0, 0)
  241.  
  242. holding = false
  243.  
  244. fakearm = rarm:Clone()
  245. fakearm.Name = "fakearm"
  246. fakearm:ClearAllChildren''
  247. fakearm.Parent = char
  248. fakearm.Transparency = 1
  249. fakearm.CanCollide = false
  250. weld = Instance.new('Weld', fakearm)
  251. weld.Part0 = fakearm
  252. weld.Part1 = rarm
  253. weld.C0 = CFrame.new(0, 0, 1)
  254.  
  255. ------------------------------------------------------------------------
  256. -- Lightning --
  257. ------------------------------------------------------------------------
  258.  
  259. Part0 = Instance.new("Part")
  260. ParticleEmitter1 = Instance.new("ParticleEmitter")
  261. Part0.Name = "lightning"
  262. Part0.Parent = nil
  263. Part0.Transparency = 1
  264. Part0.FormFactor = Enum.FormFactor.Symmetric
  265. Part0.Size = Vector3.new(0.820000052, 1.76999962, 2)
  266. Part0.CFrame = CFrame.new(26.3400002, 0.884999812, 44.9500122, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  267. Part0.Position = Vector3.new(26.3400002, 0.884999812, 44.9500122)
  268. ParticleEmitter1.Name = "Lightning"
  269. ParticleEmitter1.Parent = Part0
  270. ParticleEmitter1.Rotation = NumberRange.new(0, 360)
  271. ParticleEmitter1.Size = NumberSequence.new(1.0429447889328,3.3742332458496,0,3.3435583114624,0,3.3742332458496,0,3.6503071784973,0.030674934387207,3.7730062007904,0,3.8036811351776,0,3.8343560695648,0,3)
  272. ParticleEmitter1.Color = ColorSequence.new(Color3.new(0.27451, 0.607843, 1),Color3.new(1, 1, 1))
  273. ParticleEmitter1.LightEmission = 1
  274. ParticleEmitter1.Texture = "http://www.roblox.com/asset/?id=243098098"
  275. ParticleEmitter1.Lifetime = NumberRange.new(1, 1)
  276. ParticleEmitter1.Rate = 12312311808
  277. ParticleEmitter1.Speed = NumberRange.new(0, 0)
  278. ParticleEmitter1.Enabled = true
  279. ParticleEmitter1.Color = ColorSequence.new(Color3.new(0.27451, 0.607843, 1),Color3.new(1, 1, 1))
  280.  
  281. function Lightning(Part0,Part1,Times,Offset,Color,Thickness,Trans)
  282. local magz = (Part0 - Part1).magnitude
  283. local curpos = Part0
  284. local trz = {-Offset,Offset}
  285. for i=1,Times do
  286. local li = Instance.new("Part", torso)
  287. li.Name = "Lightning"
  288. li.TopSurface =0
  289. li.Material = "Neon"
  290. li.BottomSurface = 0
  291. li.Anchored = true
  292. li.Locked = true
  293. li.Transparency = Trans or 0.4
  294. li.BrickColor = BrickColor.new(Color)
  295. li.formFactor = "Custom"
  296. li.CanCollide = false
  297. li.Size = Vector3.new(Thickness,Thickness,magz/Times)
  298. local Offzet = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)])
  299. local trolpos = CFrame.new(curpos,Part1)*CFrame.new(0,0,magz/Times).p+Offzet
  300.  
  301. if Times == i then
  302. local magz2 = (curpos - Part1).magnitude
  303. li.Size = Vector3.new(Thickness,Thickness,magz2)
  304. li.CFrame = CFrame.new(curpos,Part1)*CFrame.new(0,0,-magz2/2)
  305. else
  306. li.CFrame = CFrame.new(curpos,trolpos)*CFrame.new(0,0,magz/Times/2)
  307. end
  308.  
  309. curpos = li.CFrame*CFrame.new(0,0,magz/Times/2).p
  310. game.Debris:AddItem(li,.1)
  311. end
  312. end
  313.  
  314. BodyParts = {}
  315. Bounding = {}
  316. --table.insert(BodyParts, fx)
  317.  
  318. for _, v in pairs(BodyParts) do
  319. local temp = {X=nil, Y=nil, Z=nil}
  320. temp.X = v.Size.X/2 * 10
  321. temp.Y = v.Size.Y/2 * 10
  322. temp.Z = v.Size.Z/2 * 10
  323. Bounding[v.Name] = temp
  324. end
  325.  
  326. spawn(function()
  327. while wait(math.random(1,7)/10) do
  328. if #BodyParts ~= 0 and #Bounding ~= 0 then
  329. local Body1 = BodyParts[math.random(#BodyParts)]
  330. local Body2 = BodyParts[math.random(#BodyParts)]
  331. local Pos1 = Vector3.new(
  332. math.random(-Bounding[Body1.Name].X, Bounding[Body1.Name].X)/10,
  333. math.random(-Bounding[Body1.Name].Y, Bounding[Body1.Name].Y)/10,
  334. math.random(-Bounding[Body1.Name].Z, Bounding[Body1.Name].Z)/10
  335. )
  336. local Pos2 = Vector3.new(
  337. math.random(-Bounding[Body2.Name].X, Bounding[Body2.Name].X)/10,
  338. math.random(-Bounding[Body2.Name].Y, Bounding[Body2.Name].Y)/10,
  339. math.random(-Bounding[Body2.Name].Z, Bounding[Body2.Name].Z)/10
  340. )
  341. local SPos1 = Body1.Position + Pos1
  342. local SPos2 = Body2.Position + Pos2
  343. Lightning(SPos1, SPos2, 4, 3, "Cyan", .3, .56)
  344. end
  345. end
  346. end)
  347.  
  348. ------------------------------------------------------------------------
  349. -- Keys --
  350. ------------------------------------------------------------------------
  351.  
  352. using = false
  353.  
  354. function weldhammer()
  355. hammer.Anchored = false
  356. hammer.CanCollide = false
  357. grab:Play()
  358. weld = Instance.new('Weld', hammer)
  359. weld.Part0 = rarm
  360. weld.Part1 = hammer
  361. weld.C0 = CFrame.new(0, -0.6, -0.7) * CFrame.Angles(math.rad(0), math.rad(180), math.rad(90))
  362. end
  363.  
  364. function gethammer()
  365. if (fakearm.Position - hammer.Position).magnitude >= 15 then
  366. stopanim = true
  367. using = true
  368. hammer.CanCollide = false
  369. hammer.Anchored = true
  370. wind:Play()
  371.  
  372. -- a = hammer.Touched:connect(function(hit)
  373. -- if hit.Parent:FindFirstChildOfClass'Humanoid' and hit.Parent.Name ~= plr.Name then
  374. -- ghit:Play()
  375. -- if hit.Parent:FindFirstChildOfClass'Humanoid'.MaxHealth <= 100 and hit.Parent:FindFirstChild'HumanoidRootPart' then
  376. -- hit.Parent:FindFirstChildOfClass'Humanoid':TakeDamage(hit.Parent:FindFirstChildOfClass'Humanoid'.MaxHealth/2/2/2)
  377. -- elseif not hit.Parent:FindFirstChildOfClass'Humanoid'.MaxHealth <= 100 then
  378. -- hit.Parent:BreakJoints''
  379. -- elseif hit:IsA'Part' or hit:IsA'MeshPart' or hit:IsA'BasePart' or hit:IsA'UnionOperation' then
  380. -- hit.Anchored = false
  381. -- bv = Instance.new('BodyVelocity', hit)
  382. -- bv.MaxForce = Vector3.new(2e9, 2e9, 2e9)
  383. -- bv.Velocity = -hit.CFrame.lookVector * 50
  384. -- game:service'Debris':AddItem(bv, 0.2)
  385. -- end
  386. -- end
  387. -- end)
  388.  
  389. for i = 0,4 do
  390. wait()
  391. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(140)), .1)
  392. end
  393. repeat wait()
  394. hammer.CFrame = clerp(hammer.CFrame, fakearm.CFrame * CFrame.new(0, -0.6, 0) * CFrame.Angles(0, math.rad(180), math.rad(90)), .1)
  395. if (fakearm.Position - hammer.Position).magnitude >= 3 then
  396. wind.Volume = 3
  397. else
  398. wind.Volume = (fakearm.Position - hammer.Position).magnitude
  399. end
  400. until (fakearm.Position - hammer.Position).magnitude <= .7
  401.  
  402. a:disconnect()
  403. hammer.Anchored = false
  404. hammer.CanCollide = false
  405. weldhammer()
  406. wind:Stop()
  407. wait(.3)
  408. stopanim = false
  409. using = false
  410. end
  411. end
  412.  
  413. function drophammer()
  414. a = hammer.Touched:connect(function(hit)
  415. if not hit.Parent:FindFirstChildOfClass'Humanoid' then
  416. drop:Play()
  417. wait(1)
  418. hammer.Anchored = true
  419. a:disconnect()
  420. end
  421. end)
  422.  
  423. hammer.Anchored = false
  424. for _, a in pairs(hammer:children'') do
  425. if a:IsA'Weld' then
  426. a:Destroy''
  427. end
  428. end
  429. hammer.CanCollide = true
  430. end
  431.  
  432. function attacktargets()
  433. if #targets >= 1 and holding then
  434. using = true
  435. hum.WalkSpeed = 0
  436. hum.JumpPower = 0
  437.  
  438. for i = 1,75 do
  439. swait()
  440. larm.Weld.C0 = clerp(larm.Weld.C0, larm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(math.rad(91), math.rad(-6), math.rad(-19)), 0.1)
  441. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(-math.rad(-165), math.rad(0), math.rad(0)), 0.1)
  442. end
  443. hum.WalkSpeed = 16
  444. hum.JumpPower = 50
  445. hammer.Anchored = true
  446. for _, a in pairs(hammer:children'') do
  447. if a:IsA'Weld' then
  448. a:Destroy''
  449. end
  450. end
  451. hammer.CanCollide = false
  452. holding = false
  453. for _, a in pairs(targets) do
  454. ttorso = gettorso(a)
  455. if a ~= nil and gettorso(a) and a:FindFirstChildOfClass'Humanoid' then
  456. repeat wait() a:FindFirstChildOfClass'Humanoid'.WalkSpeed = 5 hammer.CFrame = clerp(hammer.CFrame, ttorso.CFrame * CFrame.Angles(0, math.rad(ttorso.CFrame.lookVector.Y), 0), 0.1) until (hammer.Position - ttorso.Position).magnitude <= 6
  457. a:BreakJoints''
  458. ghit:Play()
  459. end
  460. end
  461. for _, a in pairs(rotate) do
  462. if a ~= nil then
  463. a:Destroy''
  464. end
  465. end
  466. targets = {}
  467. rotate = {}
  468. hammer.CanCollide = false
  469.  
  470.  
  471.  
  472. stopanim = true
  473. hammer.CanCollide = false
  474. hammer.Anchored = true
  475. wind:Play()
  476.  
  477. for i = 0,4 do
  478. wait()
  479. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(140)), .1)
  480. end
  481. repeat wait()
  482. hammer.CFrame = clerp(hammer.CFrame, fakearm.CFrame * CFrame.new(0, -0.6, 0) * CFrame.Angles(0, math.rad(180), math.rad(90)), .13)
  483. if (fakearm.Position - hammer.Position).magnitude >= 3 then
  484. wind.Volume = 3
  485. else
  486. wind.Volume = (fakearm.Position - hammer.Position).magnitude
  487. end
  488. until (fakearm.Position - hammer.Position).magnitude <= .7
  489.  
  490. hammer.Anchored = false
  491. hammer.CanCollide = false
  492. weldhammer()
  493. wind:Stop()
  494. holding = true
  495. wait(.3)
  496. stopanim = false
  497. using = false
  498. end
  499. end
  500.  
  501. function bgrab()
  502. for _, a in pairs(workspace:children'') do
  503. if a:FindFirstChildOfClass'Humanoid' and gettorso(a) and a.Name ~= plr.Name then
  504. ttorso = gettorso(a)
  505. if (ttorso.Position - rutprt.Position).magnitude <= 3 then
  506. using = true
  507. target2 = a
  508. stopanim2 = true
  509. target:FindFirstChildOfClass'Humanoid'.WalkSpeed = 0
  510. target:FindFirstChildOfClass'Humanoid'.JumpPower = 0
  511. hum.WalkSpeed = 0
  512. hum.JumpPower = 0
  513. for i = 0,25 do
  514. swait()
  515. larm.Weld.C0 = clerp(larm.Weld.C0, CFrame.new(-1.5,.525,0) * CFrame.Angles(math.rad(100), math.rad(20), math.rad(20)), 0.1)
  516. end
  517. weld = Instance.new('Weld', rutprt)
  518. weld.Part0 = rutprt
  519. weld.Part1 = ttorso
  520. weld.C0 = CFrame.new(-0.5, 0, -1.2)
  521.  
  522. wait(.1)
  523.  
  524.  
  525. ttorso.Anchored = true
  526. b = Instance.new('Part', char)
  527. b.Anchored = true
  528. b.CanCollide = false
  529. b.Transparency = 1
  530. b.CFrame = hed.CFrame
  531. b.Position = hed.Position + Vector3.new(0, 50, 0) + hed.CFrame.lookVector * 500
  532.  
  533. d = Instance.new('Part', char)
  534. d.Anchored = true
  535. d.CanCollide = false
  536. d.Transparency = 1
  537. d.CFrame = hed.CFrame
  538. d.Position = hed.Position - Vector3.new(0, 5.6, 0) + hed.CFrame.lookVector * -45
  539.  
  540. wait(.5)
  541. for i = 1,75 do
  542. swait()
  543. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(-math.rad(-165), math.rad(0), math.rad(0)), 0.1)
  544. end
  545. drophammer()
  546. wind:Play()
  547.  
  548. repeat wait()
  549. hammer.Anchored = true
  550. hammer.CFrame = clerp(hammer.CFrame, b.CFrame, 0.1)
  551. wind.Volume = (hammer.Position - d.Position).magnitude
  552. until (hammer.Position - b.Position).magnitude <= 5
  553.  
  554. repeat wait()
  555. hammer.Anchored = true
  556. hammer.CFrame = clerp(hammer.CFrame, d.CFrame, 0.1)
  557. wind.Volume = (hammer.Position - d.Position).magnitude
  558. until (hammer.Position - d.Position).magnitude <= 45
  559.  
  560. target2:BreakJoints''
  561. ghit:Play()
  562. wind:Stop()
  563. wait(.1)
  564. stopanim2 = false
  565. hum.WalkSpeed = 16
  566. hum.JumpPower = 50
  567. b:Destroy''
  568. d:Destroy''
  569. hammer.Anchored = false
  570. weldhammer()
  571. grab:Play()
  572. using = false
  573. end
  574. end
  575. end
  576. end
  577.  
  578. function shield()
  579. using = true
  580. hum.WalkSpeed = 0
  581. hum.JumpPower = 0
  582. for i = 1,75 do
  583. swait()
  584. larm.Weld.C0 = clerp(larm.Weld.C0, larm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(math.rad(91), math.rad(-6), math.rad(-19)), 0.1)
  585. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(-math.rad(-165), math.rad(0), math.rad(0)), 0.1)
  586. end
  587. hum.WalkSpeed = 16
  588. hum.JumpPower = 50
  589. drophammer()
  590. hammer.Anchored = true
  591. hammer.CanCollide = true
  592. using = false
  593. end
  594.  
  595. function stopshield()
  596. gethammer()
  597. end
  598.  
  599. --function transform()
  600. -- stopanim = true
  601. -- stopanim3 = true
  602. -- hum.WalkSpeed = 0
  603. -- hum.JumpPower = 0
  604. -- for i = 0,7 do
  605. -- wait()
  606. -- hammer.Weld.C0 = clerp(hammer.Weld.C0, CFrame.new(0, -2.5, -0.7) * CFrame.Angles(math.rad(-85), math.rad(180), math.rad(90)), 0.1)
  607. -- rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(-math.rad(-179), math.rad(0), math.rad(15)), 0.1)
  608. -- hed.Weld.C0 = clerp(hed.Weld.C0, hed.Weld.C0 * CFrame.new(0,0,0.2)*CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)), 0.1)
  609. -- end
  610. -- a = Instance.new('Part', char)
  611. -- a.Name = "hello"
  612. -- a.Size = Vector3.new(0.2, 0.2, 0.2)
  613. -- a.Anchored = true
  614. -- a.CanCollide = false
  615. -- a.Position = hammer.Position + Vector3.new(0, 75, 0)
  616. --
  617. -- wait(3)
  618. -- table.insert(BodyParts, fx)
  619. -- wait(4)
  620. --
  621. -- spawn(function()
  622. -- for i = 0,45 do
  623. -- swait()
  624. -- hammer.Weld.C0 = clerp(hammer.Weld.C0, CFrame.new(0, -0.6, -0.7) * CFrame.Angles(math.rad(0), math.rad(180), math.rad(90)), 0.07)
  625. -- end
  626. -- end)
  627. --
  628. -- hum.WalkSpeed = 16
  629. -- hum.JumpPower = 50
  630. -- stopanim = false
  631. -- stopanim3 = false
  632. --end
  633.  
  634. ------------------------------------------------------------------------
  635. -- Target --
  636. ------------------------------------------------------------------------
  637.  
  638. bg = Instance.new('BillboardGui', plr.PlayerGui)
  639. bg.Size = UDim2.new(15, 0, 15, 0)
  640. bg.AlwaysOnTop = true
  641. il = Instance.new('ImageLabel', bg)
  642. il.Image = "rbxassetid://142406345"
  643. il.BackgroundTransparency = 1
  644. il.Size = UDim2.new(1, 0, 1, 0)
  645. il.ImageColor3 = Color3.new(0,0,0)
  646.  
  647. home = false
  648. down = false
  649. barrier = false
  650. targets = {}
  651. rotate = {}
  652.  
  653. mouse.KeyDown:connect(function(k)
  654. key = k:lower()
  655. if key == "g" and not barrier and not using then
  656. attacktargets()
  657. end
  658.  
  659. if key == "e" and not cooldown and not barrier and not using then
  660. cooldown = true
  661. if not holding and (fakearm.Position - hammer.Position).magnitude >= 15 then
  662. holding = true
  663. gethammer()
  664. elseif holding then
  665. holding = false
  666. drophammer()
  667. end
  668. wait(.3)
  669. cooldown = false
  670. end
  671.  
  672. if key == "q" and not cooldown and holding and not barrier and not using then
  673. cooldown = true
  674. using = true
  675. hum.WalkSpeed = 0
  676. hum.JumpPower = 0
  677. for i = 1,75 do
  678. swait()
  679. larm.Weld.C0 = clerp(larm.Weld.C0, larm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(math.rad(91), math.rad(-6), math.rad(-19)), 0.1)
  680. rarm.Weld.C0 = clerp(rarm.Weld.C0, rarm.Weld.C0 * CFrame.new(0,0,0)*CFrame.Angles(-math.rad(-165), math.rad(0), math.rad(0)), 0.1)
  681. end
  682. hum.WalkSpeed = 16
  683. hum.JumpPower = 50
  684. holding = false
  685. drophammer()
  686. for i = 1,25 do
  687. wait()
  688. hammer.CFrame = clerp(hammer.CFrame, CFrame.new(9999,0,9999), 0.1)
  689. end
  690. wait(.5)
  691. cooldown = false
  692. using = false
  693. end
  694.  
  695. if key == "f" and holding and not cooldown and not barrier and not using then
  696. cooldown = true
  697. bgrab()
  698. wait(.2)
  699. cooldown = false
  700. end
  701.  
  702. if key == "v" and holding and not using then
  703. if not barrier then
  704. shield()
  705. barrier = true
  706. else
  707. barrier = false
  708. stopshield()
  709. end
  710. end
  711. end)
  712.  
  713. mouse.Button1Down:connect(function()
  714. if home and holding then
  715. clone = bg:clone()
  716. clone.Parent = plr.PlayerGui
  717. clone.ImageLabel.ImageColor3 = Color3.new(255,255,255)
  718. clone.Name = "hi"
  719. if gettorso(mouse.Target.Parent) then
  720. clone.Adornee = gettorso(mouse.Target.Parent)
  721. table.insert(targets, mouse.Target.Parent)
  722. table.insert(rotate, clone)
  723. elseif not gettorso(mouse.Target.Parent) then
  724. clone:Destroy''
  725. end
  726. end
  727. end)
  728.  
  729. spawn(function()
  730. while wait() do
  731.  
  732. il.Rotation = il.Rotation + 5
  733. if holding and mouse.Target and mouse.Target.Parent and gettorso(mouse.Target.Parent) and mouse.Target.Parent:FindFirstChildOfClass'Humanoid' and mouse.Target.Parent:FindFirstChildOfClass'Humanoid'.Health ~= 0 then
  734. target = mouse.Target.Parent
  735.  
  736. home = true
  737. il.ImageTransparency = 0
  738. bg.Adornee = gettorso(target)
  739. elseif not mouse.Target then
  740. il.ImageTransparency = 1
  741. home = false
  742. elseif not mouse.Target.Parent then
  743. il.ImageTransparency = 1
  744. home = false
  745. elseif not mouse.Target.Parent:FindFirstChildOfClass'Humanoid' then
  746. il.ImageTransparency = 1
  747. home = false
  748. end
  749.  
  750. end
  751. end)
  752.  
  753. spawn(function()
  754. while wait() do
  755. for _, a in pairs(rotate) do
  756. if a ~= nil then
  757. a.ImageLabel.Rotation = a.ImageLabel.Rotation + 5
  758. elseif targets <= 0 then
  759. a:Destroy''
  760. end
  761. end
  762. end
  763. end)
  764.  
  765. ------------------------------------------------------------------------
  766. -- Manual Pickup --
  767. ------------------------------------------------------------------------
  768.  
  769. hammer.Touched:connect(function(hit)
  770. if not holding and not using and hammer.Anchored and hit.Parent.Name == plr.Name then
  771. holding = true
  772. hammer.Anchored = false
  773. hammer.CanCollide = false
  774. weldhammer()
  775. end
  776. end)
  777.  
  778. ------------------------------------------------------------------------
  779. -- Important functions --
  780. ------------------------------------------------------------------------
  781.  
  782. died = false
  783.  
  784. function swait(num)
  785. if num == 0 or num == nil then
  786. game:service("RunService").Stepped:wait(0)
  787. else
  788. for i = 0, num do
  789. game:service("RunService").Stepped:wait(0)
  790. end
  791. end
  792. end
  793.  
  794. spawn(function()
  795. while wait() do
  796. if holding and hammer:FindFirstChildOfClass'Weld' then
  797. hammer.Anchored = false
  798. end
  799. end
  800. end)
  801.  
  802. x = 0
  803. spawn(function()
  804. while wait() do
  805. if barrier then
  806. x = x + 0.6
  807. hammer.CFrame = rutprt.CFrame * CFrame.Angles(0,0.1-x,0) * CFrame.new(25,0,0)
  808.  
  809. for _, a in pairs(workspace:children'') do
  810. ttorso = gettorso(a)
  811. if a:FindFirstChildOfClass'Humanoid' and a:FindFirstChildOfClass'Humanoid'.Health ~= 0 and a.Name ~= plr.Name and gettorso(a) and (ttorso.Position - hammer.Position).magnitude <= 15 then
  812. a:BreakJoints''
  813. ghit:Play()
  814. elseif a:FindFirstChildOfClass'Humanoid' and not gettorso(a) then
  815. a:BreakJoints''
  816. end
  817. end
  818.  
  819. for _, a in pairs(workspace:children'') do
  820. ttorso = gettorso(a)
  821. if a:FindFirstChildOfClass'Humanoid' and a:FindFirstChildOfClass'Humanoid'.Health ~= 0 and a.Name ~= plr.Name and gettorso(a) and (ttorso.Position - rutprt.Position).magnitude <= 10 then
  822. a:BreakJoints''
  823. ghit:Play()
  824. elseif a:FindFirstChildOfClass'Humanoid' and not a:FindFirstChild'HumanoidRootPart' then
  825. a:BreakJoints''
  826. end
  827. end
  828.  
  829. if x == 1 then
  830. x = 0.1
  831. end
  832. end
  833. end
  834. end)
  835.  
  836. ------------------------------------------------------------------------
  837. -- Animations --
  838. ------------------------------------------------------------------------
  839.  
  840. while true do
  841. swait()
  842.  
  843. if holding then
  844. gyro.Parent = nil
  845. elseif not holding then
  846. gyro.Parent = hammer
  847. gyro.Name = "hamma"
  848. end
  849.  
  850. ypcall(function()
  851. if anim~=lastanim then
  852. runtime=0
  853. end
  854. lastanim=anim
  855. hum.CameraOffset=(rutprt.CFrame:toObjectSpace(hed.CFrame)).p+Vector3.new(0,-1.25,0)
  856. syne=syne+.95
  857. if not otheranims and not swimming then
  858. if (torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 1 and not hum.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  859. anim="Idling"
  860. elseif hum.FloorMaterial ~= Enum.Material.Air and (rutprt.Velocity*Vector3.new(1, 0, 1)).magnitude > 1 and (rutprt.Velocity*Vector3.new(1, 0, 1)).magnitude < RunSpeed-10 and not hum.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  861. anim="Walking"
  862. elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude > RunSpeed-10 and not hum.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  863. anim="Sprinting"
  864. elseif torso.Velocity.y < -1 then
  865. anim='Falling'
  866. end
  867. end
  868.  
  869. if anim=="Idling" and hum.WalkSpeed ~= 0 then
  870. idlesineinc=35
  871.  
  872. if not stopanim then
  873. rarm.Weld.C0=clerp(rarm.Weld.C0,CFrame.new(1.5,.55+math.cos(syne/idlesineinc)/25,0)*CFrame.Angles(math.rad(1),math.rad(0),math.rad(6)),.1)
  874. end
  875.  
  876. if not stopanim2 then
  877. larm.Weld.C0=clerp(larm.Weld.C0,CFrame.new(-1.5,.55+math.cos(syne/idlesineinc)/25,0)*CFrame.Angles(math.rad(0),0,math.rad(-6)),.1)
  878. end
  879.  
  880. if not stopanim3 then
  881. hed.Weld.C0=clerp(hed.Weld.C0,CFrame.new(0,1.5+math.cos(syne/idlesineinc)/50,0)*CFrame.Angles(math.cos(syne/idlesineinc)/40,0,0),.1)
  882. end
  883.  
  884. lleg.Weld.C0=clerp(lleg.Weld.C0,CFrame.new(-.55,-1.9-math.cos(syne/idlesineinc)/20,(math.cos(syne/idlesineinc)/35))*CFrame.Angles(-(math.cos(syne/idlesineinc)/35),0,math.rad(-2.5)),.1)
  885. rleg.Weld.C0=clerp(rleg.Weld.C0,CFrame.new(.55,-1.9-math.cos(syne/idlesineinc)/20,(math.cos(syne/idlesineinc)/35))*CFrame.Angles(-(math.cos(syne/idlesineinc)/35),0,math.rad(2.5)),.1)
  886. rutprt.Weld.C0=clerp(rutprt.Weld.C0,CFrame.new(0,-.1+math.cos(syne/idlesineinc)/20,0)*CFrame.Angles(math.cos(syne/idlesineinc)/35+math.rad(0),math.rad(0),math.rad(0)),.1)
  887. end
  888.  
  889. if anim=="Walking" and hum.WalkSpeed ~= 0 then
  890. if not stopanim then
  891. rarm.Weld.C0=clerp(rarm.Weld.C0,CFrame.new(1.5,.525+math.cos(syne/15)/25,0)*CFrame.Angles(math.cos(syne/6)/1.25,math.rad(5),-(math.cos(syne/6.75)/15)+math.rad(3)),.1)
  892. end
  893.  
  894. if not stopanim2 then
  895. larm.Weld.C0=clerp(larm.Weld.C0,CFrame.new(-1.5,.525+math.cos(syne/15)/25,0)*CFrame.Angles(-(math.cos(syne/6)/1.25),0,-(math.cos(syne/6.75)/15)-math.rad(3)),.1)
  896. end
  897.  
  898. if not stopanim3 then
  899. hed.Weld.C0=clerp(hed.Weld.C0,CFrame.new(0,1.5+math.cos(syne/20)/50,0)*CFrame.Angles(-math.cos(syne/3)/20,0,0),.1)
  900. end
  901.  
  902. lleg.Weld.C0=clerp(lleg.Weld.C0,CFrame.new(-.55,-1.9-math.cos(syne/6)/10,-(math.cos(syne/6)/1.125))*CFrame.Angles(math.cos(syne/6)/1.125,0,math.rad(-2.5)),.1)
  903. rleg.Weld.C0=clerp(rleg.Weld.C0,CFrame.new(.55,-1.9-math.cos(syne/6)/10,math.cos(syne/6)/1.125)*CFrame.Angles(-(math.cos(syne/6)/1.125),0,math.rad(2.5)),.1)
  904. rutprt.Weld.C0=clerp(rutprt.Weld.C0,CFrame.new(0,-.1+math.cos(syne/3.375)/20,math.cos(syne/3)/5)*CFrame.Angles(math.cos(syne/3)/20+math.rad(-3.5),math.cos(syne/6)/10,-math.cos(syne/6)/30+math.sin(rutprt.RotVelocity.y/2)/7.5),.1)
  905. end
  906.  
  907. if hum.WalkSpeed == 0 then
  908. if not stopanim then
  909. rarm.Weld.C0=clerp(rarm.Weld.C0,CFrame.new(1.5,.55+math.cos(syne/idlesineinc)/25,0)*CFrame.Angles(math.rad(1),math.rad(0),math.rad(6)),.1)
  910. end
  911.  
  912. if not stopanim2 then
  913. larm.Weld.C0=clerp(larm.Weld.C0,CFrame.new(-1.5,.55+math.cos(syne/idlesineinc)/25,0)*CFrame.Angles(math.rad(0),0,math.rad(-6)),.1)
  914. end
  915.  
  916. if not stopanim3 then
  917. hed.Weld.C0=clerp(hed.Weld.C0,CFrame.new(0,1.5+math.cos(syne/idlesineinc)/50,0)*CFrame.Angles(math.cos(syne/idlesineinc)/40,0,0),.1)
  918. end
  919.  
  920. lleg.Weld.C0=clerp(lleg.Weld.C0,CFrame.new(-.55,-1.9-math.cos(syne/idlesineinc)/20,(math.cos(syne/idlesineinc)/35))*CFrame.Angles(-(math.cos(syne/idlesineinc)/35),0,math.rad(-2.5)),.1)
  921. rleg.Weld.C0=clerp(rleg.Weld.C0,CFrame.new(.55,-1.9-math.cos(syne/idlesineinc)/20,(math.cos(syne/idlesineinc)/35))*CFrame.Angles(-(math.cos(syne/idlesineinc)/35),0,math.rad(2.5)),.1)
  922. rutprt.Weld.C0=clerp(rutprt.Weld.C0,CFrame.new(0,-.1+math.cos(syne/idlesineinc)/20,0)*CFrame.Angles(math.cos(syne/idlesineinc)/35+math.rad(0),math.rad(0),math.rad(0)),.1)
  923. end
  924.  
  925. if 1 < rutprt.Velocity.y and hum.FloorMaterial == Enum.Material.Air and hum.JumpPower ~= 0 then
  926. hed.Weld.C0=clerp(hed.Weld.C0,CFrame.new(0,1.5,-.3)*CFrame.Angles(math.rad(-40),0,0),.065)
  927. rarm.Weld.C0=clerp(rarm.Weld.C0,CFrame.new(1.5,.525,0)*CFrame.Angles(math.rad(10),0,math.rad(70)),.1)
  928. larm.Weld.C0=clerp(larm.Weld.C0,CFrame.new(-1.5,.525,0)*CFrame.Angles(math.rad(10),0,math.rad(-70)),.1)
  929. lleg.Weld.C0=clerp(lleg.Weld.C0,CFrame.new(-.55,-1.2,0)*CFrame.Angles(math.rad(-14),0,math.rad(-2.5)),.1)
  930. rleg.Weld.C0=clerp(rleg.Weld.C0,CFrame.new(.55,-1.9,0)*CFrame.Angles(math.rad(0),0,math.rad(2.5)),.1)
  931. rutprt.Weld.C0=clerp(rutprt.Weld.C0,CFrame.new(0,-.1+math.cos(syne/20)/20,0)*CFrame.Angles(math.rad(10),math.rad(0),math.rad(0)),.1)
  932. elseif -1 > rutprt.Velocity.y and hum.FloorMaterial == Enum.Material.Air then
  933. hed.Weld.C0=clerp(hed.Weld.C0,CFrame.new(0,1.5,-.3)*CFrame.Angles(math.rad(-40),0,0),.065)
  934. rarm.Weld.C0=clerp(rarm.Weld.C0,CFrame.new(1.5,.525,0)*CFrame.Angles(math.rad(10),0,math.rad(70)),.06)
  935. larm.Weld.C0=clerp(larm.Weld.C0,CFrame.new(-1.5,.525,0)*CFrame.Angles(math.rad(10),0,math.rad(-70)),.06)
  936. lleg.Weld.C0=clerp(lleg.Weld.C0,CFrame.new(-.55,-1.2,0)*CFrame.Angles(math.rad(-14),0,math.rad(-2.5)),.06)
  937. rleg.Weld.C0=clerp(rleg.Weld.C0,CFrame.new(.55,-1.9,0)*CFrame.Angles(math.rad(0),0,math.rad(2.5)),.06)
  938. rutprt.Weld.C0=clerp(rutprt.Weld.C0,CFrame.new(0,-.1+math.cos(syne/20)/20,0)*CFrame.Angles(math.rad(10),math.rad(0),math.rad(0)),.06)
  939. end
  940. end)
  941. end
Add Comment
Please, Sign In to add comment