Advertisement
AgentVK

Stalker

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