Advertisement
PiterMosskva_TV

kitchen gun NEW

Feb 2nd, 2019
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.57 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  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,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. local plr = owner
  88. local char = plr.Character
  89. local torso = char.Torso
  90. local rs = torso["Right Shoulder"]
  91. local ls = torso["Left Shoulder"]
  92. local rh = torso["Right Hip"]
  93. local lh = torso["Left Hip"]
  94. local rj = char.HumanoidRootPart.RootJoint
  95. local neck = torso.Neck
  96. local animpose = "Idle"
  97. local attacking = false
  98. local cananim = true
  99. local rage = false
  100. local shield
  101. local sprint = false
  102. local canrage = true
  103. local legs = true
  104. local bc = char:WaitForChild("Body Colors")
  105. local multiplier = 1
  106. local lac = char["Body Colors"].LeftArmColor
  107. local rac = char["Body Colors"].RightArmColor
  108. local rlc = char["Body Colors"].RightArmColor
  109. local llc = char["Body Colors"].LeftLegColor
  110. local hc = char["Body Colors"].HeadColor
  111. local tc = char["Body Colors"].TorsoColor
  112. local humanoid = char:FindFirstChildOfClass("Humanoid")
  113. local huge = Vector3.new(math.huge, math.huge, math.huge)
  114. local mobs = Instance.new("Sound", char)
  115. mobs.SoundId = "rbxassetid://245913129"
  116. mobs.Looped = true
  117. mobs.Volume = 3
  118. humanoid.MaxHealth = math.huge
  119. wait()
  120. humanoid.Health = math.huge
  121. humanoid.Name = "BOOM BOOM BOOOMMMM!"
  122. mobs:Play()
  123. if char:FindFirstChild("Animate") then
  124. char.Animate:Destroy()
  125. end
  126. if char:FindFirstChildOfClass("Humanoid"):FindFirstChild("Animator") then
  127. char:FindFirstChildOfClass("Humanoid").Animator:Destroy()
  128. end
  129. function legsonly()
  130. spawn(function()
  131. for i = 0, 10 do
  132. wait(0.001)
  133. if attacking then
  134. break
  135. end
  136. end
  137. if not attacking then
  138. legs = false
  139. end
  140. end)
  141. end
  142. function swait(t)
  143. if t == nil or t == 0 then
  144. game:service("RunService").Stepped:wait(0)
  145. else
  146. for i = 0, t do
  147. game:service("RunService").Stepped:wait(0)
  148. end
  149. end
  150. end
  151. function KICK(PLAYER)
  152. spawn(function()
  153. local function SKICK()
  154. if PLAYER.Character and PLAYER.Character:FindFirstChild("HumanoidRootPart") and PLAYER.Character:FindFirstChild("Torso") then
  155. PLAYER.Character.HumanoidRootPart.CFrame = CFrame.new(math.random(999000, 1001000), 1000000, 1000000)
  156. do
  157. local SP = Instance.new("SkateboardPlatform", PLAYER.Character)
  158. SP.Position = PLAYER.Character.HumanoidRootPart.Position
  159. SP.Transparency = 1
  160. spawn(function()
  161. repeat
  162. swait()
  163. if PLAYER.Character and PLAYER.Character:FindFirstChild("HumanoidRootPart") then
  164. SP.Position = PLAYER.Character.HumanoidRootPart.Position
  165. end
  166. until not game:GetService("Players"):FindFirstChild(PLAYER.Name)
  167. end)
  168. PLAYER.Character.Torso.Anchored = true
  169. end
  170. end
  171. end
  172. spawn(function()
  173. repeat
  174. wait()
  175. if PLAYER ~= nil then
  176. SKICK()
  177. end
  178. until not game:GetService("Players"):FindFirstChild(PLAYER.Name)
  179. if not game:GetService("Players"):FindFirstChild(PLAYER.Name) then
  180. print("REMOVED " .. PLAYER.Name)
  181. end
  182. end)
  183. end)
  184. end
  185. function hurt(hit, dmg)
  186. if hit.Parent then
  187. if hit.Parent:IsA("LocalScript") then
  188. print("bocks!11")
  189. hit.Parent:Destroy()
  190. end
  191. local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  192. if hum and hum.Parent.Name ~= plr.Name then
  193. if dmg == "Kill" or hum.Health > 100000 then
  194. hit.Parent:BreakJoints()
  195. return true
  196. else
  197. if math.random(0, 100) == 50 then
  198. hum.Health = hum.Health - dmg * multiplier * 2.5
  199. else
  200. hum.Health = hum.Health - dmg * multiplier
  201. end
  202. return true
  203. end
  204. end
  205. end
  206. end
  207. function soundeffect(id, volume, speed, parent)
  208. spawn(function()
  209. local s = Instance.new("Sound")
  210. s.SoundId = id
  211. s.Volume = volume
  212. s.PlaybackSpeed = speed
  213. s.Parent = parent
  214. s:Play()
  215. repeat
  216. wait()
  217. until not s.Playing
  218. s:Destroy()
  219. end)
  220. end
  221. function gethum(obj)
  222. if obj.Parent and obj.Parent:FindFirstChild("Humanoid") and obj.Parent.Name ~= plr.Name then
  223. return obj.Parent:FindFirstChildOfClass("Humanoid")
  224. end
  225. end
  226. function smooth(obj)
  227. local sides = {
  228. "Left",
  229. "Right",
  230. "Top",
  231. "Bottom",
  232. "Front",
  233. "Back"
  234. }
  235. for i, v in pairs(sides) do
  236. obj[v .. "Surface"] = "SmoothNoOutlines"
  237. end
  238. end
  239. function fade(obj, dest, grow)
  240. spawn(function()
  241. local oldcf = obj.CFrame
  242. for i = 0, 10 do
  243. if grow then
  244. obj.Size = obj.Size + Vector3.new(1, 1, 1)
  245. obj.CFrame = oldcf
  246. end
  247. obj.Transparency = obj.Transparency + 0.1
  248. swait()
  249. end
  250. if dest then
  251. obj:Destroy()
  252. end
  253. end)
  254. end
  255. local keyamount = 0
  256. mouse.KeyDown:connect(function(key)
  257. if key == "w" or key == "a" or key == "s" or key == "d" then
  258. keyamount = keyamount + 1
  259. if animpose ~= "Falling" then
  260. if keyamount > 3 then
  261. keyamount = 0
  262. end
  263. animpose = "Walking"
  264. end
  265. end
  266. end)
  267. mouse.KeyUp:connect(function(key)
  268. if key == "w" or key == "a" or key == "s" or key == "d" then
  269. keyamount = keyamount - 1
  270. if keyamount < 0 then
  271. keyamount = 0
  272. end
  273. if keyamount == 0 then
  274. animpose = "Idle"
  275. end
  276. end
  277. end)
  278. local gun = Instance.new("Part")
  279. gun.Size = Vector3.new(3.175, 1.916, 0.465)
  280. gun.CanCollide = false
  281. local m = Instance.new("SpecialMesh", gun)
  282. m.MeshId = "rbxassetid://468351345"
  283. m.TextureId = "rbxassetid://468351348"
  284. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  285. gun.CFrame = char.Torso.CFrame
  286. gun.Parent = char
  287. local gunw = Instance.new("Weld", gun)
  288. gunw.Part0 = gun
  289. gunw.Part1 = char["Right Arm"]
  290. gunw.C0 = CFrame.new(-1.7838248, -0.410839319, 0, -0.0871557146, -0.996194541, 0, 0.996194541, -0.0871557146, 0, 0, 0, 1)
  291. mouse.Button1Down:connect(function()
  292. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  293. local mag = (gun.Position - mouse.Hit.p).magnitude
  294. local p = Instance.new("Part")
  295. p.CanCollide = false
  296. p.Anchored = false
  297. p.BrickColor = BrickColor.new("Institutional white")
  298. p.Size = Vector3.new(0.2, 0.2, mag)
  299. smooth(p)
  300. p.Material = "Neon"
  301. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  302. local m = Instance.new("SpecialMesh", p)
  303. m.MeshType = "Brick"
  304. p.Parent = workspace
  305. p.Touched:connect(function(hit)
  306. hurt(hit, "Kill")
  307. if hit.Size.X > 100 and 100 < hit.Size.Z and hit.Size.Y < 3 then
  308. elseif hit.Parent and hit.Parent.Name ~= plr.Name then
  309. fade(hit, true)
  310. end
  311. end)
  312. local bp = Instance.new("BodyPosition", p)
  313. bp.MaxForce = huge
  314. bp.Position = p.Position
  315. local saved = p.CFrame
  316. for i = 1, 10 do
  317. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  318. p.CFrame = saved
  319. p.Velocity = Vector3.new(0, 0, 100)
  320. p.Transparency = p.Transparency + 0.1
  321. wait()
  322. end
  323. p:Destroy()
  324. end)
  325. mouse.KeyDown:connect(function(key)
  326. if key == "l" then
  327. function a(b)
  328. pcall(function()
  329. for i, v in pairs(b:children()) do
  330. pcall(function()
  331. if v:IsA("BasePart") and v.Parent and v.Parent.Name == "WafflesAreVeryGood" and v.Anchored then
  332. v.Anchored = false
  333. end
  334. if v:IsA("Sound") and v.Parent.Name ~= "WafflesAreVeryGood" then
  335. v:Destroy()
  336. end
  337. if v:IsA("ParticleEmitter") then
  338. v:Destroy()
  339. end
  340. a(v)
  341. end)
  342. end
  343. end)
  344. end
  345. a(game)
  346. end
  347. if key == "q" then
  348. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  349. local mag = (gun.Position - mouse.Hit.p).magnitude
  350. local p = Instance.new("Part")
  351. p.CanCollide = false
  352. p.Anchored = false
  353. p.BrickColor = BrickColor.new("Really red")
  354. p.Size = Vector3.new(0.2, 0.2, mag)
  355. smooth(p)
  356. p.Material = "Neon"
  357. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  358. local m = Instance.new("SpecialMesh", p)
  359. m.MeshType = "Brick"
  360. p.Parent = workspace
  361. p.Touched:connect(function(hit)
  362. if gethum(hit) then
  363. for i, v in pairs(hit.Parent:children()) do
  364. if v:IsA("Model") then
  365. v:BreakJoints()
  366. end
  367. local ok = false
  368. for i, e in pairs({
  369. "Right Arm",
  370. "Left Arm",
  371. "Right Leg",
  372. "Left Leg",
  373. "Head",
  374. "Torso",
  375. "HumanoidRootPart"
  376. }) do
  377. if v.Name == e then
  378. ok = true
  379. end
  380. end
  381. if v:IsA("BasePart") and not ok then
  382. fade(v, true)
  383. end
  384. end
  385. end
  386. if hit:FindFirstChildOfClass("TouchTransmitter") then
  387. hit:FindFirstChildOfClass("TouchTransmitter"):Destroy()
  388. end
  389. end)
  390. local bp = Instance.new("BodyPosition", p)
  391. bp.MaxForce = huge
  392. bp.Position = p.Position
  393. local saved = p.CFrame
  394. for i = 1, 10 do
  395. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  396. p.CFrame = saved
  397. p.Velocity = Vector3.new(0, 0, 100)
  398. p.Transparency = p.Transparency + 0.1
  399. wait()
  400. end
  401. p:Destroy()
  402. end
  403. if key == "e" then
  404. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  405. local mag = (gun.Position - mouse.Hit.p).magnitude
  406. local p = Instance.new("Part")
  407. p.CanCollide = false
  408. p.Anchored = false
  409. p.BrickColor = BrickColor.new("New Yeller")
  410. p.Size = Vector3.new(0.2, 0.2, mag)
  411. smooth(p)
  412. p.Material = "Neon"
  413. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  414. local m = Instance.new("SpecialMesh", p)
  415. m.MeshType = "Brick"
  416. p.Parent = workspace
  417. p.Touched:connect(function(hit)
  418. if gethum(hit) then
  419. local target = game.Players:FindFirstChild(hit.Parent.Name)
  420. if target then
  421. KICK(target)
  422. end
  423. end
  424. end)
  425. local bp = Instance.new("BodyPosition", p)
  426. bp.MaxForce = huge
  427. bp.Position = p.Position
  428. local saved = p.CFrame
  429. for i = 1, 10 do
  430. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  431. p.CFrame = saved
  432. p.Velocity = Vector3.new(0, 0, 100)
  433. p.Transparency = p.Transparency + 0.1
  434. wait()
  435. end
  436. p:Destroy()
  437. end
  438. if key == "r" then
  439. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  440. local mag = (gun.Position - mouse.Hit.p).magnitude
  441. local p = Instance.new("Part")
  442. p.CanCollide = false
  443. p.Anchored = false
  444. p.BrickColor = BrickColor.new("Lime green")
  445. p.Size = Vector3.new(0.2, 0.2, mag)
  446. smooth(p)
  447. p.Material = "Neon"
  448. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  449. local m = Instance.new("SpecialMesh", p)
  450. m.MeshType = "Brick"
  451. p.Parent = workspace
  452. p.Touched:connect(function(hit)
  453. local hum = gethum(hit)
  454. if hum then
  455. hum.Health = hum.MaxHealth
  456. end
  457. end)
  458. local bp = Instance.new("BodyPosition", p)
  459. bp.MaxForce = huge
  460. bp.Position = p.Position
  461. local saved = p.CFrame
  462. for i = 1, 10 do
  463. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  464. p.CFrame = saved
  465. p.Velocity = Vector3.new(0, 0, 100)
  466. p.Transparency = p.Transparency + 0.1
  467. wait()
  468. end
  469. p:Destroy()
  470. end
  471. end)
  472. game:GetService("RunService").Stepped:connect(function()
  473. local x, z
  474. local dir = CFrame.new(char.HumanoidRootPart.Position, mouse.Hit.p).lookVector
  475. x = dir.X
  476. z = dir.Z
  477. local cf = CFrame.new(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position + Vector3.new(x, 0, z))
  478. char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame:Lerp(cf, 0.5)
  479. humanoid.AutoRotate = false
  480. end)
  481. while wait() do
  482. if animpose == "Walking" and cananim and legs then
  483. for i = 0, 0.7, 0.1 do
  484. if animpose == "Walking" and cananim and legs then
  485. ls.C0 = ls.C0:Lerp(CFrame.new(-1, 0.5, 0, 0, 0.104528472, -0.994522035, 0, 0.994522035, 0.104528472, 1, 0, 0), 0.2)
  486. rs.C0 = rs.C0:Lerp(CFrame.new(1.54167628, 0.0454798974, 0, -0.482965499, -0.871292651, -0.087155737, -0.0422539636, -0.0762281716, 0.996195912, -0.874620378, 0.484809875, 0), 0.2)
  487. neck.C0 = neck.C0:Lerp(CFrame.new(0, 1, 0, -0.500000656, -0.866026223, 0, -1.61309954E-9, 9.31323796E-10, 1.00000024, -0.866026342, 0.500000715, -1.86264515E-9), 0.2)
  488. rj.C0 = rj.C0:Lerp(CFrame.new(0, 0, 0, -0.469472021, 0.882948279, 0, 0, 0, 1, 0.882948279, 0.469472021, 0), 0.2)
  489. lh.C0 = lh.C0:Lerp(CFrame.new(-1, -1, 0, -0.0219629817, 0.02712203, -0.999390841, -0.628937364, 0.776673257, 0.0348994955, 0.777146697, 0.6293208, 0), 0.4)
  490. rh.C0 = rh.C0:Lerp(CFrame.new(1, -1, 0, 0.0238014236, -0.0255239103, 0.999390841, -0.681583524, 0.73090899, 0.0348994955, -0.731354535, -0.681998909, 0), 0.4)
  491. wait()
  492. else
  493. break
  494. end
  495. end
  496. for i = 0, 0.7, 0.1 do
  497. if animpose == "Walking" and cananim and legs then
  498. ls.C0 = ls.C0:Lerp(CFrame.new(-1, 0.5, 0, 0, 0.104528472, -0.994522035, 0, 0.994522035, 0.104528472, 1, 0, 0), 0.2)
  499. rs.C0 = rs.C0:Lerp(CFrame.new(1.54167628, 0.0454798974, 0, -0.482965499, -0.871292651, -0.087155737, -0.0422539636, -0.0762281716, 0.996195912, -0.874620378, 0.484809875, 0), 0.2)
  500. neck.C0 = neck.C0:Lerp(CFrame.new(0, 1, 0, -0.500000656, -0.866026223, 0, -1.61309954E-9, 9.31323796E-10, 1.00000024, -0.866026342, 0.500000715, -1.86264515E-9), 0.2)
  501. rj.C0 = rj.C0:Lerp(CFrame.new(0, 0, 0, -0.469472021, 0.882948279, 0, 0, 0, 1, 0.882948279, 0.469472021, 0), 0.2)
  502. lh.C0 = lh.C0:Lerp(CFrame.new(-1, -1, 0, 0.0205134545, 0.0282343514, -0.999390841, 0.587428331, 0.808525503, 0.0348994955, 0.809018135, -0.587786257, 0), 0.4)
  503. rh.C0 = rh.C0:Lerp(CFrame.new(1, -1, 0, -0.0224330258, -0.0267346334, 0.999390841, 0.642397523, 0.765579402, 0.0348994955, -0.76604569, 0.642788768, 0), 0.4)
  504. wait()
  505. else
  506. break
  507. end
  508. end
  509. end
  510. if animpose == "Idle" and cananim and legs then
  511. ls.C0 = ls.C0:Lerp(CFrame.new(-1, 0.5, 0, 0, 0.104528472, -0.994522035, 0, 0.994522035, 0.104528472, 1, 0, 0), 0.2)
  512. rs.C0 = rs.C0:Lerp(CFrame.new(1.54167628, 0.0454798974, 0, -0.482965499, -0.871292651, -0.087155737, -0.0422539636, -0.0762281716, 0.996195912, -0.874620378, 0.484809875, 0), 0.2)
  513. neck.C0 = neck.C0:Lerp(CFrame.new(0, 1, 0, -0.500000656, -0.866026223, 0, -1.61309954E-9, 9.31323796E-10, 1.00000024, -0.866026342, 0.500000715, -1.86264515E-9), 0.2)
  514. rj.C0 = rj.C0:Lerp(CFrame.new(0, 0, 0, -0.469472021, 0.882948279, 0, 0, 0, 1, 0.882948279, 0.469472021, 0), 0.2)
  515. lh.C0 = lh.C0:Lerp(CFrame.new(-1, -1, 0, 0, 0.0523359552, -0.99862957, 0, 0.99862957, 0.0523359552, 1, 0, 0), 0.5)
  516. rh.C0 = rh.C0:Lerp(CFrame.new(1, -1, 0, 0, -0.0523359627, 0.998629689, 0, 0.998629689, 0.0523359627, -1, 0, 0), 0.5)
  517. end
  518. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement