Advertisement
ghostteen14

Untitled

May 12th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.87 KB | None | 0 0
  1. -- This script has convert to FE by who i don't know?
  2.  
  3. -----------------------------------------------------
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,game,owner = owner,game
  6. local RealPlayer = Player
  7. do
  8. print("FE Compatibility code by Joseph Deramus")
  9. local rp = RealPlayer
  10. script.Parent = rp.Character
  11.  
  12. --RemoteEvent for communicating
  13. local Event = Instance.new("RemoteEvent")
  14. Event.Name = "UserInput_Event"
  15.  
  16. --Fake event to make stuff like Mouse.KeyDown work
  17. local function fakeEvent()
  18. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  19. t.connect = t.Connect
  20. return t
  21. end
  22.  
  23. --Creating fake input objects with fake variables
  24. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  25. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  26. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  27. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  28. end}
  29. --Merged 2 functions into one by checking amount of arguments
  30. CAS.UnbindAction = CAS.BindAction
  31.  
  32. --This function will trigger the events that have been :Connect()'ed
  33. local function te(self,ev,...)
  34. local t = m[ev]
  35. if t and t._fakeEvent then
  36. for _,f in pairs(t.Functions) do
  37. f(...)
  38. end
  39. end
  40. end
  41. m.TrigEvent = te
  42. UIS.TrigEvent = te
  43.  
  44. Event.OnServerEvent:Connect(function(plr,io)
  45. if plr~=rp then return end
  46. m.Target = io.Target
  47. m.Hit = io.Hit
  48. if not io.isMouse then
  49. local b = io.UserInputState == Enum.UserInputState.Begin
  50. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  51. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67.  
  68. local Mouse = Player:GetMouse()
  69. local UIS = game:GetService("UserInputService")
  70. local input = function(io,a)
  71. if a then return end
  72. --Since InputObject is a client-side instance, we create and pass table instead
  73. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  74. end
  75. UIS.InputBegan:Connect(input)
  76. UIS.InputEnded:Connect(input)
  77.  
  78. local h,t
  79. --Give the server mouse data 30 times every second, but only if the values changed
  80. --If player is not moving their mouse, client won't fire events
  81. while wait(1/30) do
  82. if h~=Mouse.Hit or t~=Mouse.Target then
  83. h,t=Mouse.Hit,Mouse.Target
  84. Event:FireServer({isMouse=true,Target=t,Hit=h})
  85. end
  86. end]==],Player.Character)
  87.  
  88. ----Sandboxed game object that allows the usage of client-side methods and services
  89. --Real game object
  90. local _rg = game
  91.  
  92. --Metatable for fake service
  93. local fsmt = {
  94. __index = function(self,k)
  95. local s = rawget(self,"_RealService")
  96. if s then return s[k] end
  97. end,
  98. __newindex = function(self,k,v)
  99. local s = rawget(self,"_RealService")
  100. if s then s[k]=v end
  101. end,
  102. __call = function(self,...)
  103. local s = rawget(self,"_RealService")
  104. if s then return s(...) end
  105. end
  106. }
  107. local function FakeService(t,RealService)
  108. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  109. return setmetatable(t,fsmt)
  110. end
  111.  
  112. --Fake game object
  113. local g = {
  114. GetService = function(self,s)
  115. return self[s]
  116. end,
  117. Players = FakeService({
  118. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  119. },"Players"),
  120. UserInputService = FakeService(UIS,"UserInputService"),
  121. ContextActionService = FakeService(CAS,"ContextActionService"),
  122. }
  123. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  124. g.service = g.GetService
  125.  
  126. g.RunService = FakeService({
  127. RenderStepped = _rg:GetService("RunService").Heartbeat,
  128. BindToRenderStep = function(self,name,_,fun)
  129.  
  130. end,
  131. UnbindFromRenderStep = function(self,name)
  132. self._btrs[name]:Disconnect()
  133. end,
  134. },"RunService")
  135.  
  136. setmetatable(g,{
  137. __index=function(self,s)
  138. return _rg:GetService(s) or typeof(_rg[s])=="function"
  139. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  140. end,
  141. __newindex = fsmt.__newindex,
  142. __call = fsmt.__call
  143. })
  144. --Changing owner to fake player object to support owner:GetMouse()
  145. game,owner = g,g.Players.LocalPlayer
  146. end
  147. game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 999999e999999
  148. local tool=Instance.new("HopperBin", game.Players.LocalPlayer.Backpack)
  149. tool.Name="SJ's Ultimate Ban Hammer"
  150.  
  151. wait()
  152. script.Parent=tool
  153.  
  154. --Murderer knife action script, original code from The Mad Murderer, by loleris.
  155.  
  156. wait()
  157. local camera = game.Workspace.CurrentCamera
  158. local player = game.Players.LocalPlayer
  159. local character = player.Character
  160. local humanoid = character.Humanoid
  161. local head = character.Head
  162. local torso = character.Torso
  163. local pl_mouse = player:GetMouse()
  164.  
  165. local rs = game:GetService("RunService")
  166.  
  167. local stab_damage = 9999999e9999999
  168. local walkspeeds = {80, 80}
  169.  
  170. Settings = {
  171. Equip_time = 0.1,
  172. Idle_speed = 0.1,
  173. Attack_speed = 0.1,
  174. }
  175.  
  176. local assetlink = "http://www.roblox.com/asset/?id="
  177. local hit_sounds = {"501642310", "501642310", "501642310", "501642310"}
  178. local death_sounds = {"501642310", "501642310", "501642310"}
  179. function Clean(obj)
  180. spawn(function()
  181. wait(6)
  182. obj:remove()
  183. end)
  184. end
  185.  
  186. function HIT_HANDLE(hit, dmg, pos)
  187. if hit == nil then return end
  188. local h = hit.Parent:findFirstChild("Humanoid")
  189. if h == nil then
  190. h = hit.Parent.Parent:findFirstChild("Humanoid")
  191. end
  192. if h == nil then return end
  193. if h.Health <= 0 then return end
  194.  
  195. local head = h.Parent:findFirstChild("Head")
  196. if head == nil then return end
  197.  
  198. local sound_part = Instance.new("Part")
  199. sound_part.formFactor = "Custom"
  200. sound_part.Size = Vector3.new(0.2, 0.2, 0.2)
  201. sound_part.Transparency = 1
  202. sound_part.CanCollide = false
  203. sound_part.Anchored = true
  204. sound_part.CFrame = head.CFrame
  205. Clean(sound_part)
  206. sound_part.Parent = Workspace
  207. local s_hit = Instance.new("Sound")
  208. s_hit.Volume = 1
  209. s_hit.SoundId = assetlink .. hit_sounds[math.random(1, #hit_sounds)]
  210. s_hit.Parent = sound_part
  211. local s_die = Instance.new("Sound")
  212. s_die.Volume = 1
  213. s_die.SoundId = assetlink .. death_sounds[math.random(1, #death_sounds)]
  214. s_die.Parent = sound_part
  215.  
  216. s_hit:play()
  217.  
  218. local c_tag = Instance.new("ObjectValue")
  219. c_tag.Name = "creator"
  220. c_tag.Value = player
  221. c_tag.Parent = h
  222. h.Health=0
  223. s_die:play()
  224. end
  225.  
  226. function GENERATE_IGNORELIST()
  227. local result = {character, camera}
  228. local plr = game.Players:GetPlayers()
  229. for i = 1, #plr do
  230. if plr[i] ~= player then
  231. local char = plr[i].Character
  232. if char ~= nil then
  233. local ch = char:GetChildren()
  234. for i = 1, #ch do
  235. if ch[i]:IsA("Hat") or ch[i]:IsA("Tool") then
  236. result[#result + 1] = ch[i]
  237. end
  238. end
  239. end
  240. end
  241. end
  242. return result
  243. end
  244.  
  245. function RayCast(pos1, pos2, dist, ign)
  246. local ray = Ray.new(
  247. pos1,
  248. (pos2 - pos1).unit * math.abs(dist)
  249. )
  250. local hit, hpos = Workspace:FindPartOnRayWithIgnoreList(ray, ign, false)
  251. return hit, hpos
  252. end
  253.  
  254. local larm = character:findFirstChild("Left Arm")
  255. local rarm = character:findFirstChild("Right Arm")
  256. function Slash(del)
  257. coroutine.resume(coroutine.create(function()
  258. local hits = {}
  259.  
  260. local start = tick()
  261. local actv = true
  262.  
  263. local function ishitted(obj)
  264. for i = 1, #hits do
  265. if obj:IsDescendantOf(hits[i]) then
  266. return true
  267. end
  268. end
  269. return false
  270. end
  271.  
  272. local function hitp(hit)
  273. if ishitted(hit) then return end
  274. local h = hit.Parent:findFirstChild("Humanoid")
  275. if h == nil then
  276. h = hit.Parent.Parent:findFirstChild("Humanoid")
  277. end
  278. if h == nil then return end
  279. hits[#hits + 1] = h.Parent
  280. HIT_HANDLE(hit, stab_damage)
  281. end
  282.  
  283. local con = {
  284. larm.Touched:connect(hitp),
  285. rarm.Touched:connect(hitp),
  286. }
  287.  
  288. while tick() - start <= Settings.Attack_speed do wait() end
  289. actv = false
  290. con[1]:disconnect()
  291. con[2]:disconnect()
  292. end))
  293. end
  294.  
  295. local dg_sounds = {
  296. equip = {
  297. "465591978"
  298. },
  299. hit = {
  300. "501642310",
  301. "501642310",
  302. "501642310",
  303. "501642310"
  304. },
  305. swing = {
  306. "528494638",
  307. "528494638",
  308. "528494638",
  309. "528494638"
  310. }
  311. }
  312.  
  313. local dg_soundobj = {}
  314. for k, v in pairs(dg_sounds) do
  315. dg_soundobj[k] = {}
  316. for i = 1, #v do
  317. local ns = Instance.new("Sound")
  318. ns.SoundId = assetlink .. v[i]
  319. ns.Volume = 1
  320. dg_soundobj[k][#dg_soundobj[k] + 1] = ns
  321. end
  322. end
  323.  
  324. function LoadSounds()
  325. for __, v in pairs(dg_soundobj) do
  326. for i = 1, #v do
  327. v[i].Parent = head
  328. end
  329. end
  330. end
  331. function RemoveSounds()
  332. for __, v in pairs(dg_soundobj) do
  333. for i = 1, #v do
  334. v[i].Parent = nil
  335. end
  336. end
  337. end
  338. function PlaySound(nm, dl)
  339. if dl == nil then
  340. dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
  341. else
  342. coroutine.resume(coroutine.create(function()
  343. wait(dl)
  344. dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
  345. end))
  346. end
  347. end
  348.  
  349. _G.MurderKnife_AnimType = "Default"
  350. _G.MurderKnife_AnimState = 0
  351.  
  352. function Animate(tp, st)
  353. _G.MurderKnife_AnimType = tp
  354. _G.MurderKnife_AnimState = st
  355. end
  356.  
  357. tool.Selected:connect(function(mouse) --Default, Idle1, Idle2, Attack1, Attack2
  358. humanoid.WalkSpeed = walkspeeds[2]
  359. mouse.Icon = assetlink .. "54019936"
  360. Animate("Equip", 0)
  361. LoadSounds()
  362. PlaySound("equip", 0.1)
  363.  
  364. local anim_equip = 1
  365. local last_action = tick()
  366. local idle_rand = math.random(4, 7)
  367. local idle_perform = 0
  368. local idle_type = 1
  369.  
  370. local attack_perform = 0
  371. local attack_type = 1
  372.  
  373. local running = true
  374. local last_c = tick()
  375.  
  376. local click_start = tick()
  377. mouse.Button1Down:connect(function()
  378. if not running or anim_equip > 0 then return end
  379. if tick() - attack_perform <= Settings.Attack_speed then return end
  380. attack_perform = tick()
  381. last_action = tick()
  382. attack_type = math.random(1, 3)
  383. idle_perform = 0
  384. PlaySound("swing", 0.1)
  385. Slash(0.1)
  386. end)
  387.  
  388. local conn = rs.RenderStepped:connect(function()
  389. if not running then return end
  390. local delta = tick() - last_c
  391. last_c = tick()
  392.  
  393. if anim_equip > 0 then
  394. anim_equip = math.max(0, anim_equip - (delta / Settings.Equip_time))
  395. Animate("Equip", 1 - anim_equip)
  396. elseif tick() - attack_perform <= Settings.Attack_speed then
  397. Animate("Attack" .. attack_type, (tick() - attack_perform) / Settings.Attack_speed)
  398. idle_perform = 0
  399. elseif tick() - idle_perform <= Settings.Idle_speed then
  400. Animate("Idle" .. idle_type, (tick() - idle_perform) / Settings.Idle_speed)
  401. else
  402. Animate("Default", 0)
  403. end
  404.  
  405. if tick() - last_action >= idle_rand then
  406. idle_rand = math.random(12, 20)
  407. last_action = tick()
  408. idle_perform = tick()
  409. idle_type = math.random(1, 2)
  410. end
  411.  
  412. end)
  413. tool.Deselected:connect(function() running = false conn:disconnect() end)
  414. end)
  415. tool.Deselected:connect(function()
  416. RemoveSounds()
  417. humanoid.WalkSpeed = walkspeeds[1]
  418. end)
  419.  
  420. --Murderer knife animation module, original code from The Mad Murderer, by loleris.
  421.  
  422. local mouse = pl_mouse
  423.  
  424. local conn_type = "Snap"
  425.  
  426. local anim_head = false
  427.  
  428. weapon_properties = {
  429. mesh_id = "http://www.roblox.com/asset/?id=10604848",
  430. texture_id = "http://www.roblox.com/asset/?id=10605252",
  431. scale = Vector3.new(0.5, 0.5, 0.5),
  432. transparency = 0,
  433. reflectance = 0,
  434. brick_color = BrickColor.new("Really black"),
  435. }
  436.  
  437. --How did I make all of this? Magic. Didn't even need an animation editor :)
  438. Animations = {
  439. Default = {
  440. {{}, 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)}
  441. },
  442. Equip = {
  443. {{}, 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)},
  444. {{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)},
  445. {{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)},
  446. },
  447. Idle1 = {
  448. {{}, 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)},
  449. {{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)},
  450. {{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)},
  451. {{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)},
  452. },
  453. Idle2 = {
  454. {{}, 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)},
  455. {{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)},
  456. {{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)},
  457. {{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)},
  458. {{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)}
  459. },
  460. Attack1 = {
  461. {{}, 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)},
  462. {{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)},
  463. {{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)},
  464. {{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)}
  465. },
  466. Attack2 = {
  467. {{}, 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)},
  468. {{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)},
  469. {{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)},
  470. {{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)}
  471. },
  472. Attack3 = {
  473. {{}, 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)},
  474. {{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)},
  475. {{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)},
  476. {{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.
  477. }
  478. }
  479.  
  480.  
  481. function CFrameTrans(GetCFrame1, GetCFrame2, GetNumber)
  482. local Diff2 = GetCFrame2.p - GetCFrame1.p
  483. GetCFrame1_s = GetCFrame1 - GetCFrame1.p
  484. GetCFrame2 = GetCFrame2 - GetCFrame2.p
  485. local Diff = GetCFrame1_s:inverse() * GetCFrame2
  486. local x1, y1, z1 = Diff:toEulerAnglesXYZ()
  487. return (GetCFrame1 + (Diff2 * GetNumber)) * CFrame.Angles(x1 * GetNumber, y1 * GetNumber, z1 * GetNumber)
  488. end
  489.  
  490. function TransEff(x, type)
  491. if type == 1 then
  492. return x
  493. elseif type == 2 then
  494. return x*x*(3 - 2*x)
  495. elseif type == 3 then
  496. return math.sin(math.rad(x * 90))
  497. elseif type == 4 then
  498. return 1 - math.sin(math.rad((1 - x) * 90))
  499. end
  500. end
  501.  
  502. function num_trans(n1, n2, x)
  503. return n1 + ((n2 - n1) * x)
  504. end
  505.  
  506. function PlayAnimation(anim_name, tm) --return {left, right, wep, trans}
  507. tm = math.min(1, math.max(0, tm))
  508. local animd = Animations[anim_name]
  509. if #animd == 1 then
  510. return {animd[1][3], animd[1][4], animd[1][5], animd[1][2]}
  511. else
  512. local trans_from = 1
  513. local trans_to = 1
  514. local tm_left = tm
  515. for i = 2, #animd do
  516. tm_left = tm_left - animd[i][1][1]
  517. if tm_left <= 0 then
  518. trans_from = i - 1
  519. trans_to = i
  520. break
  521. end
  522. end
  523. local trans_amm = TransEff((animd[trans_to][1][1] + tm_left) / animd[trans_to][1][1], animd[trans_to][1][2])
  524. return {
  525. CFrameTrans(animd[trans_from][3], animd[trans_to][3], trans_amm),
  526. CFrameTrans(animd[trans_from][4], animd[trans_to][4], trans_amm),
  527. CFrameTrans(animd[trans_from][5], animd[trans_to][5], trans_amm),
  528. num_trans(animd[trans_from][2], animd[trans_to][2], trans_amm)
  529. }
  530. end
  531. end
  532.  
  533. rot_amplitude_head = 20
  534. rot_amplitude_chest = 15
  535.  
  536. anim_p = {
  537. cam_offset = CFrame.new(0.2, -0.37, 0.91) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)),
  538. aim_amp = 0.5,
  539. aim_max_change = 4,
  540. aim_retract = 15,
  541. aim_max_deg = 20,
  542. }
  543.  
  544. local weapon_model = Instance.new("Part")
  545. weapon_model.CanCollide = false
  546. weapon_model.Name = "WeaponObject"
  547. weapon_model.formFactor = "Custom"
  548. weapon_model.Size = Vector3.new(0.2, 0.2, 0.2)
  549. weapon_model.TopSurface = 0
  550. weapon_model.BottomSurface = 0
  551. weapon_model.BrickColor = weapon_properties.brick_color
  552. weapon_model.Transparency = weapon_properties.transparency
  553. weapon_model.Reflectance = weapon_properties.reflectance
  554. local mesh = Instance.new("SpecialMesh", weapon_model)
  555. mesh.Scale = weapon_properties.scale
  556. mesh.MeshId = weapon_properties.mesh_id
  557. mesh.TextureId = weapon_properties.texture_id
  558.  
  559. torso = character.Torso
  560. head = character.Head
  561.  
  562. motors = {torso:findFirstChild("Left Shoulder"), torso:findFirstChild("Right Shoulder"), torso:findFirstChild("Neck")}
  563. welds = {nil, nil, nil}
  564. weapon_parts = {weapon_model:clone(), weapon_model:clone()}
  565. weapon_model = nil
  566.  
  567. function EndAnimation()
  568. if motors[1] then
  569. motors[1].Part1 = character:findFirstChild("Left Arm")
  570. end
  571. if motors[2] then
  572. motors[2].Part1 = character:findFirstChild("Right Arm")
  573. end
  574. if motors[3] then
  575. motors[3].Part1 = character:findFirstChild("Head")
  576. end
  577. if welds[1] then
  578. welds[1]:remove()
  579. welds[1] = nil
  580. end
  581. if welds[2] then
  582. welds[2]:remove()
  583. welds[2] = nil
  584. end
  585. if welds[3] then
  586. welds[3]:remove()
  587. welds[3] = nil
  588. end
  589. weapon_parts[1].Parent = nil
  590. if weapon_model then
  591. weapon_model.Parent = nil
  592. end
  593. coroutine.resume(coroutine.create(function()
  594. local swm = weapon_model
  595. wait()
  596. swm.Parent = nil
  597. wait(0.1)
  598. swm.Parent = nil
  599. wait(0.5)
  600. swm.Parent = nil
  601. end))
  602. end
  603.  
  604. local anim_model = Instance.new("Model")
  605. anim_model.Name = "WeaponAnimation"
  606. weapon_model = anim_model
  607.  
  608. local cam_larm = Instance.new("Part")
  609. cam_larm.Parent = anim_model
  610. cam_larm.BrickColor = BrickColor.new("Really black")
  611. cam_larm.formFactor = "Custom"
  612. cam_larm.Size = Vector3.new(0.2, 0.2, 0.2)
  613. cam_larm.TopSurface = 0
  614. cam_larm.BottomSurface = 0
  615. cam_larm.Transparency = 0.4
  616. cam_larm.CanCollide = false
  617. local hmesh = Instance.new("BlockMesh", cam_larm)
  618. hmesh.Scale = Vector3.new(5, 10, 5)
  619.  
  620. local cam_rarm = cam_larm:clone()
  621. cam_rarm.Parent = anim_model
  622.  
  623. function StartAnimation()
  624. local check = {torso:findFirstChild("LeftWeld"), torso:findFirstChild("RightWeld"), torso:findFirstChild("HeadWeld")}
  625. if check[1] then check[1]:remove() end
  626. if check[2] then check[2]:remove() end
  627. if check[3] then check[3]:remove() end
  628. local check2 = {character:findFirstChild("WeaponObject"), camera:findFirstChild("WeaponAnimation")}
  629. if check2[1] then check2[1].Parent = nil end
  630. if check2[2] then check2[2].Parent = nil end
  631. if motors[1] then
  632. motors[1].Part1 = nil
  633. end
  634. if motors[2] then
  635. motors[2].Part1 = nil
  636. end
  637. if motors[3] then
  638. motors[3].Part1 = nil
  639. end
  640. welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
  641. welds[1].Part0 = torso
  642. welds[2].Part0 = torso
  643. welds[3].Part0 = torso
  644. welds[1].Part1 = character:findFirstChild("Left Arm")
  645. welds[2].Part1 = character:findFirstChild("Right Arm")
  646. welds[3].Part1 = character:findFirstChild("Head")
  647. welds[1].Name = "LeftWeld"
  648. welds[2].Name = "RightWeld"
  649. welds[2].Name = "HeadWeld"
  650. welds[1].C0 = CFrame.new(-1.5, 0, 0)
  651. welds[2].C0 = CFrame.new(1.5, 0, 0)
  652. welds[3].C0 = CFrame.new(0, 1.5, 0)
  653. welds[1].Parent = torso
  654. welds[2].Parent = torso
  655. welds[3].Parent = torso
  656.  
  657. weapon_parts[1].Parent = character
  658. local wep_weld = Instance.new(conn_type)
  659. wep_weld.Part0 = character:findFirstChild("Right Arm")
  660. wep_weld.Part1 = weapon_parts[1]
  661. wep_weld.C0 = CFrame.new()
  662. wep_weld.Parent = weapon_parts[1]
  663.  
  664. local weld1 = welds[1]
  665. local weld2 = welds[2]
  666. local weld3 = welds[3]
  667.  
  668. local cam_welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
  669. cam_welds[1].Part0 = torso
  670. cam_welds[1].Part1 = cam_larm
  671. cam_welds[1].Parent = cam_larm
  672. cam_welds[2].Part0 = torso
  673. cam_welds[2].Part1 = cam_rarm
  674. cam_welds[2].Parent = cam_rarm
  675. cam_welds[3].Part0 = cam_rarm
  676. cam_welds[3].Part1 = weapon_parts[2]
  677. cam_welds[3].Parent = weapon_parts[2]
  678. weapon_parts[2].Parent = anim_model
  679.  
  680. local move_anim_speed = 3
  681. local last_p = Vector3.new()
  682. local move_amm = 0
  683. coroutine.resume(coroutine.create(function()
  684. while weld1.Parent ~= nil do
  685. local delta = wait(1/25)
  686. local cur_p = torso.Position
  687. if (cur_p - last_p).magnitude >= 0.1 then
  688. move_amm = math.min(1, move_amm + delta * move_anim_speed)
  689. else
  690. move_amm = math.max(0, move_amm - delta * move_anim_speed)
  691. end
  692. last_p = cur_p
  693. end
  694. end))
  695.  
  696. local r_serv = game:GetService("RunService")
  697.  
  698. --EASTER EGG
  699. function easein(x)
  700. return math.sin(math.rad(x * 90))
  701. end
  702.  
  703. local a_horse = (character:findFirstChild("HorseHead") ~= nil)
  704. local horse_displace = {0, 0}
  705. local horse_cf = CFrame.Angles(0.0001, 0.0001, 0)
  706. if a_horse then
  707. coroutine.resume(coroutine.create(function()
  708. while weld1.Parent ~= nil do
  709. local rndwait = (math.random(100, 1000) / 1000) * 4
  710. wait(rndwait)
  711. local oldd = {horse_displace[1], horse_displace[2]}
  712. local disp2 = {math.random(-60, 60), math.random(0, 25)}
  713.  
  714. local ld = 0
  715. while ld ~= 1 do
  716. local st = tick()
  717. r_serv.RenderStepped:wait()
  718. ld = math.min(1, ld + ((tick() - st) * 4))
  719. local eff = easein(ld)
  720.  
  721. local x = oldd[1] - ((oldd[1] - disp2[1]) * eff)
  722. local y = oldd[2] - ((oldd[2] - disp2[2]) * eff)
  723. horse_displace = {x, y}
  724. horse_cf = CFrame.Angles(math.rad(y), math.rad(x) , 0)
  725. end
  726. end
  727. end))
  728. end
  729.  
  730. --EASTER EGG
  731.  
  732. local last_va = 0
  733. local last_va2 = 0
  734. local view_velocity = {0, 0}
  735.  
  736. coroutine.resume(coroutine.create(function()
  737. local last_time = tick()
  738. while weld1.Parent ~= nil do
  739. r_serv.RenderStepped:wait() ------------------------------------------------
  740. local delta = tick() - last_time
  741. last_time = tick()
  742.  
  743. local breathe_amp = 2
  744. local breathe_freq = 0.8
  745. local breathe = math.sin(math.rad(tick() * 90 * breathe_freq)) * breathe_amp
  746.  
  747. local shake_freq = 5
  748. local shake_amp = {0.05, 0.05}
  749. local arm_shake = CFrame.new(
  750. math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[1],
  751. 0,
  752. math.abs(math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[2]))
  753.  
  754.  
  755. --ANIMATION LOOP
  756. local p_distance = (head.Position - mouse.Hit.p).magnitude
  757. if p_distance == 0 then p_distance = 0.0001 end
  758. local p_height = mouse.Hit.p.y - head.Position.y
  759. local view_angle
  760. if p_height ~= 0 then
  761. view_angle = math.deg(math.asin(math.abs(p_height) / p_distance)) * (math.abs(p_height) / p_height)
  762. else
  763. view_angle = 0
  764. end
  765.  
  766. local cam_cf = camera.CoordinateFrame
  767. local looking_at = cam_cf * CFrame.new(0, 0, -100)
  768. local view_angle2 = math.deg(math.atan2(cam_cf.p.x - looking_at.p.x, cam_cf.p.z - looking_at.p.z)) + 180
  769.  
  770. local v_delta1, v_delta2
  771. local dir1 = 0
  772. local dir2 = 0
  773. v_delta1 = math.abs(view_angle - last_va)
  774. if v_delta1 ~= 0 then
  775. dir1 = (view_angle - last_va) / v_delta1
  776. end
  777. local va_check = {math.abs(view_angle2 - last_va2), 360 - math.abs(view_angle2 - last_va2)}
  778. if view_angle2 == last_va2 then
  779. dir2 = 0
  780. v_delta2 = 0
  781. elseif va_check[1] < va_check[2] then
  782. v_delta2 = va_check[1]
  783. dir2 = (view_angle2 - last_va2) / va_check[1]
  784. else
  785. v_delta2 = va_check[2]
  786. if last_va2 > view_angle2 then
  787. dir2 = 1
  788. else
  789. dir2 = -1
  790. end
  791. end
  792. last_va = view_angle
  793. last_va2 = view_angle2
  794.  
  795. view_velocity[1] = view_velocity[1] / (1 + (delta * anim_p.aim_retract))
  796. view_velocity[2] = view_velocity[2] / (1 + (delta * anim_p.aim_retract))
  797.  
  798. local calc1 = v_delta1 * dir1 * anim_p.aim_amp
  799. if calc1 ~= 0 then
  800. view_velocity[1] = view_velocity[1] + (math.min(anim_p.aim_max_change, math.abs(calc1)) * (calc1 / math.abs(calc1)))
  801. end
  802. local calc2 = v_delta2 * dir2 * anim_p.aim_amp
  803. if calc2 ~= 0 then
  804. view_velocity[2] = view_velocity[2] + (math.min(anim_p.aim_max_change, math.abs(calc2)) * (calc2 / math.abs(calc2)))
  805. end
  806.  
  807. if view_velocity[1] ~= 0 then
  808. view_velocity[1] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[1])) * (math.abs(view_velocity[1]) / view_velocity[1])
  809. end
  810. if view_velocity[2] ~= 0 then
  811. view_velocity[2] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[2])) * (math.abs(view_velocity[2]) / view_velocity[2])
  812. end
  813.  
  814. local anmtp = _G.MurderKnife_AnimType
  815. local anmst = _G.MurderKnife_AnimState
  816.  
  817. if anmst == nil then
  818. anmst = 0
  819. end
  820.  
  821. if anmtp ~= nil then
  822. if Animations[anmtp] == nil then
  823. anmtp = "Default"
  824. end
  825. else
  826. anmtp = "Default"
  827. end
  828. local curr_anim = PlayAnimation(anmtp, anmst) --left, right, weapon, wep trans
  829.  
  830. --curr_anim = {Animations.Default[1][3], Animations.Default[1][4], Animations.Default[1][5], 0}
  831.  
  832. 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)
  833. weld1.C1 = (chestCF * curr_anim[1] * CFrame.new(0, -0.5, 0)):inverse()
  834. weld2.C1 = (chestCF * curr_anim[2] * CFrame.new(0, -0.5, 0)):inverse()
  835. wep_weld.C1 = (curr_anim[3]):inverse()
  836. weapon_parts[1].Transparency = curr_anim[4]
  837. if anim_head then
  838. 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()
  839. else
  840. weld3.C1 = (CFrame.new(0, 0, 0)):inverse()
  841. end
  842.  
  843. if (head.Position - camera.CoordinateFrame.p).magnitude < 3 then
  844. if anim_model.Parent == nil then
  845. anim_model.Parent = camera
  846. end
  847. cam_welds[1].Parent = cam_larm
  848. cam_welds[2].Parent = cam_rarm
  849. cam_welds[3].Parent = weapon_parts[2]
  850. 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
  851. 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()
  852. 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()
  853. cam_welds[3].C1 = (curr_anim[3]):inverse()
  854. weapon_parts[2].Transparency = curr_anim[4]
  855. else
  856. if anim_model.Parent ~= nil then
  857. anim_model.Parent = nil
  858. end
  859. end
  860. --ANIMATION LOOP
  861. end
  862. end))
  863. end
  864.  
  865. local last_st = 0
  866. local eq = false
  867. tool.Selected:connect(function(mouse)
  868. if eq then return end
  869. eq = true
  870. wait()
  871. StartAnimation()
  872. end)
  873.  
  874. tool.Deselected:connect(function()
  875. eq = false
  876. EndAnimation()
  877. end)
  878.  
  879. local p = game.Players.LocalPlayer.Character
  880. local weld = Instance.new("Weld",p.Torso)
  881. weld.Part0 = p.Torso
  882. local weld2 = Instance.new("Weld",p.Torso)
  883. weld2.Part0 = p.Torso
  884. local Smoke = Instance.new("Part",p.Torso)
  885. Smoke.Anchored = true
  886. Smoke.CanCollide = false
  887. Smoke.Size = Vector3.new(1,1,1)
  888. Smoke.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  889. weld2.Part1 = Smoke
  890. weld2.C1 = CFrame.new(0,-4,3.5)-- * CFrame.Angles(0,math.rad(180),0)
  891. Smoke.Anchored = false
  892. Smoke.Transparency = 1;
  893.  
  894. local Particle = Instance.new("ParticleEmitter",Smoke)
  895. Particle.Rate = 3;
  896. Particle.Speed = NumberRange.new(30,30);
  897. Particle.VelocitySpread = 40;
  898. Particle.Texture = "rbxassetid://3412753"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement