Advertisement
Theskyler900

shedletsky beta

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