Advertisement
ericdesouza

The ban hammer

Jan 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.62 KB | None | 0 0
  1. game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 999999e999999
  2. local tool=Instance.new("HopperBin", game.Players.LocalPlayer.Backpack)
  3. tool.Name="SJ's Ultimate Ban Hammer"
  4.  
  5. wait()
  6. script.Parent=tool
  7.  
  8. local s = Instance.new("Sound",char)
  9. s.SoundId = "http://www.roblox.com/asset/?id=853707984"
  10. s.Pitch = 1
  11. s.Volume = 2
  12. s.Looped = true
  13. wait(1)
  14. s:play()
  15.  
  16. --Murderer knife action script, original code from The Mad Murderer, by loleris.
  17.  
  18. wait()
  19. local camera = game.Workspace.CurrentCamera
  20. local player = game.Players.LocalPlayer
  21. local character = player.Character
  22. local humanoid = character.Humanoid
  23. local head = character.Head
  24. local torso = character.Torso
  25. local pl_mouse = player:GetMouse()
  26.  
  27. local rs = game:GetService("RunService")
  28.  
  29. local stab_damage = 9999999e9999999
  30. local walkspeeds = {80, 80}
  31.  
  32. Settings = {
  33. Equip_time = 0.1,
  34. Idle_speed = 0.1,
  35. Attack_speed = 0.1,
  36. }
  37.  
  38. local assetlink = "http://www.roblox.com/asset/?id="
  39. local hit_sounds = {"501642310", "501642310", "501642310", "501642310"}
  40. local death_sounds = {"501642310", "501642310", "501642310"}
  41. function Clean(obj)
  42. spawn(function()
  43. wait(6)
  44. obj:remove()
  45. end)
  46. end
  47.  
  48. function HIT_HANDLE(hit, dmg, pos)
  49. if hit == nil then return end
  50. local h = hit.Parent:findFirstChild("Humanoid")
  51. if h == nil then
  52. h = hit.Parent.Parent:findFirstChild("Humanoid")
  53. end
  54. if h == nil then return end
  55. if h.Health <= 0 then return end
  56.  
  57. local head = h.Parent:findFirstChild("Head")
  58. if head == nil then return end
  59.  
  60. local sound_part = Instance.new("Part")
  61. sound_part.formFactor = "Custom"
  62. sound_part.Size = Vector3.new(0.2, 0.2, 0.2)
  63. sound_part.Transparency = 1
  64. sound_part.CanCollide = false
  65. sound_part.Anchored = true
  66. sound_part.CFrame = head.CFrame
  67. Clean(sound_part)
  68. sound_part.Parent = Workspace
  69. local s_hit = Instance.new("Sound")
  70. s_hit.Volume = 1
  71. s_hit.SoundId = assetlink .. hit_sounds[math.random(1, #hit_sounds)]
  72. s_hit.Parent = sound_part
  73. local s_die = Instance.new("Sound")
  74. s_die.Volume = 1
  75. s_die.SoundId = assetlink .. death_sounds[math.random(1, #death_sounds)]
  76. s_die.Parent = sound_part
  77.  
  78. s_hit:play()
  79.  
  80. local c_tag = Instance.new("ObjectValue")
  81. c_tag.Name = "creator"
  82. c_tag.Value = player
  83. c_tag.Parent = h
  84. h.Health=0
  85. s_die:play()
  86. end
  87.  
  88. function GENERATE_IGNORELIST()
  89. local result = {character, camera}
  90. local plr = game.Players:GetPlayers()
  91. for i = 1, #plr do
  92. if plr[i] ~= player then
  93. local char = plr[i].Character
  94. if char ~= nil then
  95. local ch = char:GetChildren()
  96. for i = 1, #ch do
  97. if ch[i]:IsA("Hat") or ch[i]:IsA("Tool") then
  98. result[#result + 1] = ch[i]
  99. end
  100. end
  101. end
  102. end
  103. end
  104. return result
  105. end
  106.  
  107. function RayCast(pos1, pos2, dist, ign)
  108. local ray = Ray.new(
  109. pos1,
  110. (pos2 - pos1).unit * math.abs(dist)
  111. )
  112. local hit, hpos = Workspace:FindPartOnRayWithIgnoreList(ray, ign, false)
  113. return hit, hpos
  114. end
  115.  
  116. local larm = character:findFirstChild("Left Arm")
  117. local rarm = character:findFirstChild("Right Arm")
  118. function Slash(del)
  119. coroutine.resume(coroutine.create(function()
  120. local hits = {}
  121.  
  122. local start = tick()
  123. local actv = true
  124.  
  125. local function ishitted(obj)
  126. for i = 1, #hits do
  127. if obj:IsDescendantOf(hits[i]) then
  128. return true
  129. end
  130. end
  131. return false
  132. end
  133.  
  134. local function hitp(hit)
  135. if ishitted(hit) then return end
  136. local h = hit.Parent:findFirstChild("Humanoid")
  137. if h == nil then
  138. h = hit.Parent.Parent:findFirstChild("Humanoid")
  139. end
  140. if h == nil then return end
  141. hits[#hits + 1] = h.Parent
  142. HIT_HANDLE(hit, stab_damage)
  143. end
  144.  
  145. local con = {
  146. larm.Touched:connect(hitp),
  147. rarm.Touched:connect(hitp),
  148. }
  149.  
  150. while tick() - start <= Settings.Attack_speed do wait() end
  151. actv = false
  152. con[1]:disconnect()
  153. con[2]:disconnect()
  154. end))
  155. end
  156.  
  157. local dg_sounds = {
  158. equip = {
  159. "465591978"
  160. },
  161. hit = {
  162. "501642310",
  163. "501642310",
  164. "501642310",
  165. "501642310"
  166. },
  167. swing = {
  168. "528494638",
  169. "528494638",
  170. "528494638",
  171. "528494638"
  172. }
  173. }
  174.  
  175. local dg_soundobj = {}
  176. for k, v in pairs(dg_sounds) do
  177. dg_soundobj[k] = {}
  178. for i = 1, #v do
  179. local ns = Instance.new("Sound")
  180. ns.SoundId = assetlink .. v[i]
  181. ns.Volume = 1
  182. dg_soundobj[k][#dg_soundobj[k] + 1] = ns
  183. end
  184. end
  185.  
  186. function LoadSounds()
  187. for __, v in pairs(dg_soundobj) do
  188. for i = 1, #v do
  189. v[i].Parent = head
  190. end
  191. end
  192. end
  193. function RemoveSounds()
  194. for __, v in pairs(dg_soundobj) do
  195. for i = 1, #v do
  196. v[i].Parent = nil
  197. end
  198. end
  199. end
  200. function PlaySound(nm, dl)
  201. if dl == nil then
  202. dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
  203. else
  204. coroutine.resume(coroutine.create(function()
  205. wait(dl)
  206. dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
  207. end))
  208. end
  209. end
  210.  
  211. _G.MurderKnife_AnimType = "Default"
  212. _G.MurderKnife_AnimState = 0
  213.  
  214. function Animate(tp, st)
  215. _G.MurderKnife_AnimType = tp
  216. _G.MurderKnife_AnimState = st
  217. end
  218.  
  219. tool.Selected:connect(function(mouse) --Default, Idle1, Idle2, Attack1, Attack2
  220. humanoid.WalkSpeed = walkspeeds[2]
  221. mouse.Icon = assetlink .. "54019936"
  222. Animate("Equip", 0)
  223. LoadSounds()
  224. PlaySound("equip", 0.1)
  225.  
  226. local anim_equip = 1
  227. local last_action = tick()
  228. local idle_rand = math.random(4, 7)
  229. local idle_perform = 0
  230. local idle_type = 1
  231.  
  232. local attack_perform = 0
  233. local attack_type = 1
  234.  
  235. local running = true
  236. local last_c = tick()
  237.  
  238. local click_start = tick()
  239. mouse.Button1Down:connect(function()
  240. if not running or anim_equip > 0 then return end
  241. if tick() - attack_perform <= Settings.Attack_speed then return end
  242. attack_perform = tick()
  243. last_action = tick()
  244. attack_type = math.random(1, 3)
  245. idle_perform = 0
  246. PlaySound("swing", 0.1)
  247. Slash(0.1)
  248. end)
  249.  
  250. local conn = rs.RenderStepped:connect(function()
  251. if not running then return end
  252. local delta = tick() - last_c
  253. last_c = tick()
  254.  
  255. if anim_equip > 0 then
  256. anim_equip = math.max(0, anim_equip - (delta / Settings.Equip_time))
  257. Animate("Equip", 1 - anim_equip)
  258. elseif tick() - attack_perform <= Settings.Attack_speed then
  259. Animate("Attack" .. attack_type, (tick() - attack_perform) / Settings.Attack_speed)
  260. idle_perform = 0
  261. elseif tick() - idle_perform <= Settings.Idle_speed then
  262. Animate("Idle" .. idle_type, (tick() - idle_perform) / Settings.Idle_speed)
  263. else
  264. Animate("Default", 0)
  265. end
  266.  
  267. if tick() - last_action >= idle_rand then
  268. idle_rand = math.random(12, 20)
  269. last_action = tick()
  270. idle_perform = tick()
  271. idle_type = math.random(1, 2)
  272. end
  273.  
  274. end)
  275. tool.Deselected:connect(function() running = false conn:disconnect() end)
  276. end)
  277. tool.Deselected:connect(function()
  278. RemoveSounds()
  279. humanoid.WalkSpeed = walkspeeds[1]
  280. end)
  281.  
  282. --Murderer knife animation module, original code from The Mad Murderer, by loleris.
  283.  
  284. local mouse = pl_mouse
  285.  
  286. local conn_type = "Snap"
  287.  
  288. local anim_head = false
  289.  
  290. weapon_properties = {
  291. mesh_id = "http://www.roblox.com/asset/?id=10604848",
  292. texture_id = "http://www.roblox.com/asset/?id=10605252",
  293. scale = Vector3.new(0.6, 0.6, 0.6),
  294. transparency = 0,
  295. reflectance = 0,
  296. brick_color = BrickColor.new("Really black"),
  297. }
  298.  
  299. --How did I make all of this? Magic. Didn't even need an animation editor :)
  300. Animations = {
  301. Default = {
  302. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
  303. },
  304. Equip = {
  305. {{}, 0, CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, -1.3, -0.5) * CFrame.Angles(-2.618, 0, 0)},
  306. {{0.8, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.524, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  307. {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  308. },
  309. Idle1 = {
  310. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  311. {{0.3, 2}, 0, CFrame.new(0.8, -0.301, 0.2) * CFrame.Angles(-0.35, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.523, 1.221, -0.699), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 1.221, 0)},
  312. {{0.55, 2}, 0, CFrame.new(0.2, -0.5, 0.2) * CFrame.Angles(-0.14, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 1.221, -0.175), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.746, 1.221, 0.174)},
  313. {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  314. },
  315. Idle2 = {
  316. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  317. {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.524, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, -0.175, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0.523, 0)},
  318. {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.349, 0, 0.523), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.174, 0.698, -0.524), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
  319. {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.61, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.139, 0.663, -0.489), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
  320. {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
  321. },
  322. Attack1 = {
  323. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  324. {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.872, 0.349, 0.087), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  325. {{0.15, 2}, 0, CFrame.new(0.4, -0.101, 0.1) * CFrame.Angles(-1.571, 0, -0.35), CFrame.new(-0.301, -0.301, 0.1) * CFrame.Angles(-1.048, -0.175, -0.524), CFrame.new(0, -1.201, -0.801) * CFrame.Angles(-2.095, 0, 0)},
  326. {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
  327. },
  328. Attack2 = {
  329. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  330. {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.699, 0, 0.872), CFrame.new(-0.401, 0.3, 0.1) * CFrame.Angles(1.919, 2.443, -1.222), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  331. {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, -0.524), CFrame.new(-0.5, -0.201, -0.101) * CFrame.Angles(0.523, 1.396, -0.873), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  332. {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
  333. },
  334. Attack3 = {
  335. {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
  336. {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, -0.201, 0) * CFrame.Angles(1.396, 0.698, -1.571), CFrame.new(0, -1.3, -0.401) * CFrame.Angles(-2.444, 0, 0)},
  337. {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, 0.1, 0) * CFrame.Angles(0.349, 2.094, -0.524), CFrame.new(0, -1.3, 0.1) * CFrame.Angles(-3.84, 0, 0)},
  338. {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)} --Psst. Create a dummy, try setting position and angles of limbs and the weapon, save CFrame data to code. Easy? Yes. When making a single knife tool, it was all you needed.
  339. }
  340. }
  341.  
  342.  
  343. function CFrameTrans(GetCFrame1, GetCFrame2, GetNumber)
  344. local Diff2 = GetCFrame2.p - GetCFrame1.p
  345. GetCFrame1_s = GetCFrame1 - GetCFrame1.p
  346. GetCFrame2 = GetCFrame2 - GetCFrame2.p
  347. local Diff = GetCFrame1_s:inverse() * GetCFrame2
  348. local x1, y1, z1 = Diff:toEulerAnglesXYZ()
  349. return (GetCFrame1 + (Diff2 * GetNumber)) * CFrame.Angles(x1 * GetNumber, y1 * GetNumber, z1 * GetNumber)
  350. end
  351.  
  352. function TransEff(x, type)
  353. if type == 1 then
  354. return x
  355. elseif type == 2 then
  356. return x*x*(3 - 2*x)
  357. elseif type == 3 then
  358. return math.sin(math.rad(x * 90))
  359. elseif type == 4 then
  360. return 1 - math.sin(math.rad((1 - x) * 90))
  361. end
  362. end
  363.  
  364. function num_trans(n1, n2, x)
  365. return n1 + ((n2 - n1) * x)
  366. end
  367.  
  368. function PlayAnimation(anim_name, tm) --return {left, right, wep, trans}
  369. tm = math.min(1, math.max(0, tm))
  370. local animd = Animations[anim_name]
  371. if #animd == 1 then
  372. return {animd[1][3], animd[1][4], animd[1][5], animd[1][2]}
  373. else
  374. local trans_from = 1
  375. local trans_to = 1
  376. local tm_left = tm
  377. for i = 2, #animd do
  378. tm_left = tm_left - animd[i][1][1]
  379. if tm_left <= 0 then
  380. trans_from = i - 1
  381. trans_to = i
  382. break
  383. end
  384. end
  385. local trans_amm = TransEff((animd[trans_to][1][1] + tm_left) / animd[trans_to][1][1], animd[trans_to][1][2])
  386. return {
  387. CFrameTrans(animd[trans_from][3], animd[trans_to][3], trans_amm),
  388. CFrameTrans(animd[trans_from][4], animd[trans_to][4], trans_amm),
  389. CFrameTrans(animd[trans_from][5], animd[trans_to][5], trans_amm),
  390. num_trans(animd[trans_from][2], animd[trans_to][2], trans_amm)
  391. }
  392. end
  393. end
  394.  
  395. rot_amplitude_head = 20
  396. rot_amplitude_chest = 15
  397.  
  398. anim_p = {
  399. cam_offset = CFrame.new(0.2, -0.37, 0.91) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)),
  400. aim_amp = 0.5,
  401. aim_max_change = 4,
  402. aim_retract = 15,
  403. aim_max_deg = 20,
  404. }
  405.  
  406. local weapon_model = Instance.new("Part")
  407. weapon_model.CanCollide = false
  408. weapon_model.Name = "WeaponObject"
  409. weapon_model.formFactor = "Custom"
  410. weapon_model.Size = Vector3.new(0.2, 0.2, 0.2)
  411. weapon_model.TopSurface = 0
  412. weapon_model.BottomSurface = 0
  413. weapon_model.BrickColor = weapon_properties.brick_color
  414. weapon_model.Transparency = weapon_properties.transparency
  415. weapon_model.Reflectance = weapon_properties.reflectance
  416. local mesh = Instance.new("SpecialMesh", weapon_model)
  417. mesh.Scale = weapon_properties.scale
  418. mesh.MeshId = weapon_properties.mesh_id
  419. mesh.TextureId = weapon_properties.texture_id
  420.  
  421. torso = character.Torso
  422. head = character.Head
  423.  
  424. motors = {torso:findFirstChild("Left Shoulder"), torso:findFirstChild("Right Shoulder"), torso:findFirstChild("Neck")}
  425. welds = {nil, nil, nil}
  426. weapon_parts = {weapon_model:clone(), weapon_model:clone()}
  427. weapon_model = nil
  428.  
  429. function EndAnimation()
  430. if motors[1] then
  431. motors[1].Part1 = character:findFirstChild("Left Arm")
  432. end
  433. if motors[2] then
  434. motors[2].Part1 = character:findFirstChild("Right Arm")
  435. end
  436. if motors[3] then
  437. motors[3].Part1 = character:findFirstChild("Head")
  438. end
  439. if welds[1] then
  440. welds[1]:remove()
  441. welds[1] = nil
  442. end
  443. if welds[2] then
  444. welds[2]:remove()
  445. welds[2] = nil
  446. end
  447. if welds[3] then
  448. welds[3]:remove()
  449. welds[3] = nil
  450. end
  451. weapon_parts[1].Parent = nil
  452. if weapon_model then
  453. weapon_model.Parent = nil
  454. end
  455. coroutine.resume(coroutine.create(function()
  456. local swm = weapon_model
  457. wait()
  458. swm.Parent = nil
  459. wait(0.1)
  460. swm.Parent = nil
  461. wait(0.5)
  462. swm.Parent = nil
  463. end))
  464. end
  465.  
  466. local anim_model = Instance.new("Model")
  467. anim_model.Name = "WeaponAnimation"
  468. weapon_model = anim_model
  469.  
  470. local cam_larm = Instance.new("Part")
  471. cam_larm.Parent = anim_model
  472. cam_larm.BrickColor = BrickColor.new("Really black")
  473. cam_larm.formFactor = "Custom"
  474. cam_larm.Size = Vector3.new(0.2, 0.2, 0.2)
  475. cam_larm.TopSurface = 0
  476. cam_larm.BottomSurface = 0
  477. cam_larm.Transparency = 0.4
  478. cam_larm.CanCollide = false
  479. local hmesh = Instance.new("BlockMesh", cam_larm)
  480. hmesh.Scale = Vector3.new(5, 10, 5)
  481.  
  482. local cam_rarm = cam_larm:clone()
  483. cam_rarm.Parent = anim_model
  484.  
  485. function StartAnimation()
  486. local check = {torso:findFirstChild("LeftWeld"), torso:findFirstChild("RightWeld"), torso:findFirstChild("HeadWeld")}
  487. if check[1] then check[1]:remove() end
  488. if check[2] then check[2]:remove() end
  489. if check[3] then check[3]:remove() end
  490. local check2 = {character:findFirstChild("WeaponObject"), camera:findFirstChild("WeaponAnimation")}
  491. if check2[1] then check2[1].Parent = nil end
  492. if check2[2] then check2[2].Parent = nil end
  493. if motors[1] then
  494. motors[1].Part1 = nil
  495. end
  496. if motors[2] then
  497. motors[2].Part1 = nil
  498. end
  499. if motors[3] then
  500. motors[3].Part1 = nil
  501. end
  502. welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
  503. welds[1].Part0 = torso
  504. welds[2].Part0 = torso
  505. welds[3].Part0 = torso
  506. welds[1].Part1 = character:findFirstChild("Left Arm")
  507. welds[2].Part1 = character:findFirstChild("Right Arm")
  508. welds[3].Part1 = character:findFirstChild("Head")
  509. welds[1].Name = "LeftWeld"
  510. welds[2].Name = "RightWeld"
  511. welds[2].Name = "HeadWeld"
  512. welds[1].C0 = CFrame.new(-1.5, 0, 0)
  513. welds[2].C0 = CFrame.new(1.5, 0, 0)
  514. welds[3].C0 = CFrame.new(0, 1.5, 0)
  515. welds[1].Parent = torso
  516. welds[2].Parent = torso
  517. welds[3].Parent = torso
  518.  
  519. weapon_parts[1].Parent = character
  520. local wep_weld = Instance.new(conn_type)
  521. wep_weld.Part0 = character:findFirstChild("Right Arm")
  522. wep_weld.Part1 = weapon_parts[1]
  523. wep_weld.C0 = CFrame.new()
  524. wep_weld.Parent = weapon_parts[1]
  525.  
  526. local weld1 = welds[1]
  527. local weld2 = welds[2]
  528. local weld3 = welds[3]
  529.  
  530. local cam_welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
  531. cam_welds[1].Part0 = torso
  532. cam_welds[1].Part1 = cam_larm
  533. cam_welds[1].Parent = cam_larm
  534. cam_welds[2].Part0 = torso
  535. cam_welds[2].Part1 = cam_rarm
  536. cam_welds[2].Parent = cam_rarm
  537. cam_welds[3].Part0 = cam_rarm
  538. cam_welds[3].Part1 = weapon_parts[2]
  539. cam_welds[3].Parent = weapon_parts[2]
  540. weapon_parts[2].Parent = anim_model
  541.  
  542. local move_anim_speed = 3
  543. local last_p = Vector3.new()
  544. local move_amm = 0
  545. coroutine.resume(coroutine.create(function()
  546. while weld1.Parent ~= nil do
  547. local delta = wait(1/25)
  548. local cur_p = torso.Position
  549. if (cur_p - last_p).magnitude >= 0.1 then
  550. move_amm = math.min(1, move_amm + delta * move_anim_speed)
  551. else
  552. move_amm = math.max(0, move_amm - delta * move_anim_speed)
  553. end
  554. last_p = cur_p
  555. end
  556. end))
  557.  
  558. local r_serv = game:GetService("RunService")
  559.  
  560. --EASTER EGG
  561. function easein(x)
  562. return math.sin(math.rad(x * 90))
  563. end
  564.  
  565. local a_horse = (character:findFirstChild("HorseHead") ~= nil)
  566. local horse_displace = {0, 0}
  567. local horse_cf = CFrame.Angles(0.0001, 0.0001, 0)
  568. if a_horse then
  569. coroutine.resume(coroutine.create(function()
  570. while weld1.Parent ~= nil do
  571. local rndwait = (math.random(100, 1000) / 1000) * 4
  572. wait(rndwait)
  573. local oldd = {horse_displace[1], horse_displace[2]}
  574. local disp2 = {math.random(-60, 60), math.random(0, 25)}
  575.  
  576. local ld = 0
  577. while ld ~= 1 do
  578. local st = tick()
  579. r_serv.RenderStepped:wait()
  580. ld = math.min(1, ld + ((tick() - st) * 4))
  581. local eff = easein(ld)
  582.  
  583. local x = oldd[1] - ((oldd[1] - disp2[1]) * eff)
  584. local y = oldd[2] - ((oldd[2] - disp2[2]) * eff)
  585. horse_displace = {x, y}
  586. horse_cf = CFrame.Angles(math.rad(y), math.rad(x) , 0)
  587. end
  588. end
  589. end))
  590. end
  591.  
  592. --EASTER EGG
  593.  
  594. local last_va = 0
  595. local last_va2 = 0
  596. local view_velocity = {0, 0}
  597.  
  598. coroutine.resume(coroutine.create(function()
  599. local last_time = tick()
  600. while weld1.Parent ~= nil do
  601. r_serv.RenderStepped:wait() ------------------------------------------------
  602. local delta = tick() - last_time
  603. last_time = tick()
  604.  
  605. local breathe_amp = 2
  606. local breathe_freq = 0.8
  607. local breathe = math.sin(math.rad(tick() * 90 * breathe_freq)) * breathe_amp
  608.  
  609. local shake_freq = 5
  610. local shake_amp = {0.05, 0.05}
  611. local arm_shake = CFrame.new(
  612. math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[1],
  613. 0,
  614. math.abs(math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[2]))
  615.  
  616.  
  617. --ANIMATION LOOP
  618. local p_distance = (head.Position - mouse.Hit.p).magnitude
  619. if p_distance == 0 then p_distance = 0.0001 end
  620. local p_height = mouse.Hit.p.y - head.Position.y
  621. local view_angle
  622. if p_height ~= 0 then
  623. view_angle = math.deg(math.asin(math.abs(p_height) / p_distance)) * (math.abs(p_height) / p_height)
  624. else
  625. view_angle = 0
  626. end
  627.  
  628. local cam_cf = camera.CoordinateFrame
  629. local looking_at = cam_cf * CFrame.new(0, 0, -100)
  630. local view_angle2 = math.deg(math.atan2(cam_cf.p.x - looking_at.p.x, cam_cf.p.z - looking_at.p.z)) + 180
  631.  
  632. local v_delta1, v_delta2
  633. local dir1 = 0
  634. local dir2 = 0
  635. v_delta1 = math.abs(view_angle - last_va)
  636. if v_delta1 ~= 0 then
  637. dir1 = (view_angle - last_va) / v_delta1
  638. end
  639. local va_check = {math.abs(view_angle2 - last_va2), 360 - math.abs(view_angle2 - last_va2)}
  640. if view_angle2 == last_va2 then
  641. dir2 = 0
  642. v_delta2 = 0
  643. elseif va_check[1] < va_check[2] then
  644. v_delta2 = va_check[1]
  645. dir2 = (view_angle2 - last_va2) / va_check[1]
  646. else
  647. v_delta2 = va_check[2]
  648. if last_va2 > view_angle2 then
  649. dir2 = 1
  650. else
  651. dir2 = -1
  652. end
  653. end
  654. last_va = view_angle
  655. last_va2 = view_angle2
  656.  
  657. view_velocity[1] = view_velocity[1] / (1 + (delta * anim_p.aim_retract))
  658. view_velocity[2] = view_velocity[2] / (1 + (delta * anim_p.aim_retract))
  659.  
  660. local calc1 = v_delta1 * dir1 * anim_p.aim_amp
  661. if calc1 ~= 0 then
  662. view_velocity[1] = view_velocity[1] + (math.min(anim_p.aim_max_change, math.abs(calc1)) * (calc1 / math.abs(calc1)))
  663. end
  664. local calc2 = v_delta2 * dir2 * anim_p.aim_amp
  665. if calc2 ~= 0 then
  666. view_velocity[2] = view_velocity[2] + (math.min(anim_p.aim_max_change, math.abs(calc2)) * (calc2 / math.abs(calc2)))
  667. end
  668.  
  669. if view_velocity[1] ~= 0 then
  670. view_velocity[1] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[1])) * (math.abs(view_velocity[1]) / view_velocity[1])
  671. end
  672. if view_velocity[2] ~= 0 then
  673. view_velocity[2] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[2])) * (math.abs(view_velocity[2]) / view_velocity[2])
  674. end
  675.  
  676. local anmtp = _G.MurderKnife_AnimType
  677. local anmst = _G.MurderKnife_AnimState
  678.  
  679. if anmst == nil then
  680. anmst = 0
  681. end
  682.  
  683. if anmtp ~= nil then
  684. if Animations[anmtp] == nil then
  685. anmtp = "Default"
  686. end
  687. else
  688. anmtp = "Default"
  689. end
  690. local curr_anim = PlayAnimation(anmtp, anmst) --left, right, weapon, wep trans
  691.  
  692. --curr_anim = {Animations.Default[1][3], Animations.Default[1][4], Animations.Default[1][5], 0}
  693.  
  694. local chestCF = CFrame.new(0, 0.5, 0) * CFrame.Angles(math.rad(math.max(-rot_amplitude_chest, math.min(rot_amplitude_chest, view_angle)) + 90 + breathe), 0, 0)
  695. weld1.C1 = (chestCF * curr_anim[1] * CFrame.new(0, -0.5, 0)):inverse()
  696. weld2.C1 = (chestCF * curr_anim[2] * CFrame.new(0, -0.5, 0)):inverse()
  697. wep_weld.C1 = (curr_anim[3]):inverse()
  698. weapon_parts[1].Transparency = curr_anim[4]
  699. if anim_head then
  700. weld3.C1 = (CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(math.max(-rot_amplitude_head, math.min(rot_amplitude_head, view_angle))), 0, 0) * horse_cf):inverse()
  701. else
  702. weld3.C1 = (CFrame.new(0, 0, 0)):inverse()
  703. end
  704.  
  705. if (head.Position - camera.CoordinateFrame.p).magnitude < 3 then
  706. if anim_model.Parent == nil then
  707. anim_model.Parent = camera
  708. end
  709. cam_welds[1].Parent = cam_larm
  710. cam_welds[2].Parent = cam_rarm
  711. cam_welds[3].Parent = weapon_parts[2]
  712. local cam_cf = camera.CoordinateFrame * CFrame.Angles(math.rad(90 + (breathe / 2) - view_velocity[1]), 0, math.rad(view_velocity[2])) * arm_shake * anim_p.cam_offset
  713. cam_welds[1].C1 = (torso.CFrame:inverse() * cam_cf * CFrame.new(-1.5, 0, 0) * curr_anim[1] * CFrame.new(0, -0.5, 0)):inverse()
  714. cam_welds[2].C1 = (torso.CFrame:inverse() * cam_cf * CFrame.new(1.5, 0, 0) * curr_anim[2] * CFrame.new(0, -0.5, 0)):inverse()
  715. cam_welds[3].C1 = (curr_anim[3]):inverse()
  716. weapon_parts[2].Transparency = curr_anim[4]
  717. else
  718. if anim_model.Parent ~= nil then
  719. anim_model.Parent = nil
  720. end
  721. end
  722. --ANIMATION LOOP
  723. end
  724. end))
  725. end
  726.  
  727. local last_st = 0
  728. local eq = false
  729. tool.Selected:connect(function(mouse)
  730. if eq then return end
  731. eq = true
  732. wait()
  733. StartAnimation()
  734. end)
  735.  
  736. tool.Deselected:connect(function()
  737. eq = false
  738. EndAnimation()
  739. end)
  740.  
  741. local p = game.Players.LocalPlayer.Character
  742. local weld = Instance.new("Weld",p.Torso)
  743. weld.Part0 = p.Torso
  744. local weld2 = Instance.new("Weld",p.Torso)
  745. weld2.Part0 = p.Torso
  746. local Smoke = Instance.new("Part",p.Torso)
  747. Smoke.Anchored = true
  748. Smoke.CanCollide = false
  749. Smoke.Size = Vector3.new(1,1,1)
  750. Smoke.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  751. weld2.Part1 = Smoke
  752. weld2.C1 = CFrame.new(0,-4,3.5)-- * CFrame.Angles(0,math.rad(180),0)
  753. Smoke.Anchored = false
  754. Smoke.Transparency = 1;
  755.  
  756. local Particle = Instance.new("ParticleEmitter",Smoke)
  757. Particle.Rate = 3;
  758. Particle.Speed = NumberRange.new(30,30);
  759. Particle.VelocitySpread = 40;
  760. Particle.Texture = "rbxassetid://3412753"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement