Advertisement
yoyo74456

Kitchen Gun

Aug 27th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.71 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  6. local plr = game.Players.LocalPlayer
  7. local char = plr.Character
  8. local mouse = plr:GetMouse()
  9. local torso = char.Torso
  10. local rs = torso["Right Shoulder"]
  11. local ls = torso["Left Shoulder"]
  12. local rh = torso["Right Hip"]
  13. local lh = torso["Left Hip"]
  14. local rj = char.HumanoidRootPart.RootJoint
  15. local neck = torso.Neck
  16. local animpose = "Idle"
  17. local attacking = false
  18. local cananim = true
  19. local rage = false
  20. local shield
  21. local sprint = false
  22. local canrage = true
  23. local legs = true
  24. local bc = char:WaitForChild("Body Colors")
  25. local multiplier = 1
  26. local lac = char["Body Colors"].LeftArmColor
  27. local rac = char["Body Colors"].RightArmColor
  28. local rlc = char["Body Colors"].RightArmColor
  29. local llc = char["Body Colors"].LeftLegColor
  30. local hc = char["Body Colors"].HeadColor
  31. local tc = char["Body Colors"].TorsoColor
  32. local humanoid = char:FindFirstChildOfClass("Humanoid")
  33. local huge = Vector3.new(math.huge, math.huge, math.huge)
  34. local mobs = Instance.new("Sound", char)
  35. mobs.SoundId = "rbxassetid://245913129"
  36. mobs.Looped = true
  37. mobs.Volume = 3
  38. humanoid.MaxHealth = math.huge
  39. wait()
  40. humanoid.Health = math.huge
  41. humanoid.Name = "BOOM BOOM BOOOMMMM!"
  42. mobs:Play()
  43. if char:FindFirstChild("Animate") then
  44. char.Animate:Destroy()
  45. end
  46. if char:FindFirstChildOfClass("Humanoid"):FindFirstChild("Animator") then
  47. char:FindFirstChildOfClass("Humanoid").Animator:Destroy()
  48. end
  49. function legsonly()
  50. spawn(function()
  51. for i = 0, 10 do
  52. wait(0.001)
  53. if attacking then
  54. break
  55. end
  56. end
  57. if not attacking then
  58. legs = false
  59. end
  60. end)
  61. end
  62. function swait(t)
  63. if t == nil or t == 0 then
  64. game:service("RunService").Stepped:wait(0)
  65. else
  66. for i = 0, t do
  67. game:service("RunService").Stepped:wait(0)
  68. end
  69. end
  70. end
  71. function KICK(PLAYER)
  72. spawn(function()
  73. local function SKICK()
  74. if PLAYER.Character and PLAYER.Character:FindFirstChild("HumanoidRootPart") and PLAYER.Character:FindFirstChild("Torso") then
  75. PLAYER.Character.HumanoidRootPart.CFrame = CFrame.new(math.random(999000, 1001000), 1000000, 1000000)
  76. do
  77. local SP = Instance.new("SkateboardPlatform", PLAYER.Character)
  78. SP.Position = PLAYER.Character.HumanoidRootPart.Position
  79. SP.Transparency = 1
  80. spawn(function()
  81. repeat
  82. swait()
  83. if PLAYER.Character and PLAYER.Character:FindFirstChild("HumanoidRootPart") then
  84. SP.Position = PLAYER.Character.HumanoidRootPart.Position
  85. end
  86. until not game:GetService("Players"):FindFirstChild(PLAYER.Name)
  87. end)
  88. PLAYER.Character.Torso.Anchored = true
  89. end
  90. end
  91. end
  92. spawn(function()
  93. repeat
  94. wait()
  95. if PLAYER ~= nil then
  96. SKICK()
  97. end
  98. until not game:GetService("Players"):FindFirstChild(PLAYER.Name)
  99. if not game:GetService("Players"):FindFirstChild(PLAYER.Name) then
  100. print("REMOVED " .. PLAYER.Name)
  101. end
  102. end)
  103. end)
  104. end
  105. function hurt(hit, dmg)
  106. if hit.Parent then
  107. if hit.Parent:IsA("LocalScript") then
  108. print("bocks!11")
  109. hit.Parent:Destroy()
  110. end
  111. local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  112. if hum and hum.Parent.Name ~= plr.Name then
  113. if dmg == "Kill" or hum.Health > 100000 then
  114. hit.Parent:BreakJoints()
  115. return true
  116. else
  117. if math.random(0, 100) == 50 then
  118. hum.Health = hum.Health - dmg * multiplier * 2.5
  119. else
  120. hum.Health = hum.Health - dmg * multiplier
  121. end
  122. return true
  123. end
  124. end
  125. end
  126. end
  127. function soundeffect(id, volume, speed, parent)
  128. spawn(function()
  129. local s = Instance.new("Sound")
  130. s.SoundId = id
  131. s.Volume = volume
  132. s.PlaybackSpeed = speed
  133. s.Parent = parent
  134. s:Play()
  135. repeat
  136. wait()
  137. until not s.Playing
  138. s:Destroy()
  139. end)
  140. end
  141. function gethum(obj)
  142. if obj.Parent and obj.Parent:FindFirstChild("Humanoid") and obj.Parent.Name ~= plr.Name then
  143. return obj.Parent:FindFirstChildOfClass("Humanoid")
  144. end
  145. end
  146. function smooth(obj)
  147. local sides = {
  148. "Left",
  149. "Right",
  150. "Top",
  151. "Bottom",
  152. "Front",
  153. "Back"
  154. }
  155. for i, v in pairs(sides) do
  156. obj[v .. "Surface"] = "SmoothNoOutlines"
  157. end
  158. end
  159. function fade(obj, dest, grow)
  160. spawn(function()
  161. local oldcf = obj.CFrame
  162. for i = 0, 10 do
  163. if grow then
  164. obj.Size = obj.Size + Vector3.new(1, 1, 1)
  165. obj.CFrame = oldcf
  166. end
  167. obj.Transparency = obj.Transparency + 0.1
  168. swait()
  169. end
  170. if dest then
  171. obj:Destroy()
  172. end
  173. end)
  174. end
  175. local keyamount = 0
  176. mouse.KeyDown:connect(function(key)
  177. if key == "w" or key == "a" or key == "s" or key == "d" then
  178. keyamount = keyamount + 1
  179. if animpose ~= "Falling" then
  180. if keyamount > 3 then
  181. keyamount = 0
  182. end
  183. animpose = "Walking"
  184. end
  185. end
  186. end)
  187. mouse.KeyUp:connect(function(key)
  188. if key == "w" or key == "a" or key == "s" or key == "d" then
  189. keyamount = keyamount - 1
  190. if keyamount < 0 then
  191. keyamount = 0
  192. end
  193. if keyamount == 0 then
  194. animpose = "Idle"
  195. end
  196. end
  197. end)
  198. local gun = Instance.new("Part")
  199. gun.Size = Vector3.new(3.175, 1.916, 0.465)
  200. gun.CanCollide = false
  201. local m = Instance.new("SpecialMesh", gun)
  202. m.MeshId = "rbxassetid://468351345"
  203. m.TextureId = "rbxassetid://468351348"
  204. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  205. gun.CFrame = char.Torso.CFrame
  206. gun.Parent = char
  207. local gunw = Instance.new("Weld", gun)
  208. gunw.Part0 = gun
  209. gunw.Part1 = char["Right Arm"]
  210. gunw.C0 = CFrame.new(-1.7838248, -0.410839319, 0, -0.0871557146, -0.996194541, 0, 0.996194541, -0.0871557146, 0, 0, 0, 1)
  211. mouse.Button1Down:connect(function()
  212. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  213. local mag = (gun.Position - mouse.Hit.p).magnitude
  214. local p = Instance.new("Part")
  215. p.CanCollide = false
  216. p.Anchored = false
  217. p.BrickColor = BrickColor.new("Institutional white")
  218. p.Size = Vector3.new(0.2, 0.2, mag)
  219. smooth(p)
  220. p.Material = "Neon"
  221. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  222. local m = Instance.new("SpecialMesh", p)
  223. m.MeshType = "Brick"
  224. p.Parent = workspace
  225. p.Touched:connect(function(hit)
  226. hurt(hit, "Kill")
  227. if hit.Size.X > 100 and 100 < hit.Size.Z and hit.Size.Y < 3 then
  228. elseif hit.Parent and hit.Parent.Name ~= plr.Name then
  229. fade(hit, true)
  230. end
  231. end)
  232. local bp = Instance.new("BodyPosition", p)
  233. bp.MaxForce = huge
  234. bp.Position = p.Position
  235. local saved = p.CFrame
  236. for i = 1, 10 do
  237. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  238. p.CFrame = saved
  239. p.Velocity = Vector3.new(0, 0, 100)
  240. p.Transparency = p.Transparency + 0.1
  241. wait()
  242. end
  243. p:Destroy()
  244. end)
  245. mouse.KeyDown:connect(function(key)
  246. if key == "l" then
  247. function a(b)
  248. pcall(function()
  249. for i, v in pairs(b:children()) do
  250. pcall(function()
  251. if v:IsA("BasePart") and v.Parent and v.Parent.Name == "WafflesAreVeryGood" and v.Anchored then
  252. v.Anchored = false
  253. end
  254. if v:IsA("Sound") and v.Parent.Name ~= "WafflesAreVeryGood" then
  255. v:Destroy()
  256. end
  257. if v:IsA("ParticleEmitter") then
  258. v:Destroy()
  259. end
  260. a(v)
  261. end)
  262. end
  263. end)
  264. end
  265. a(game)
  266. end
  267. if key == "q" then
  268. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  269. local mag = (gun.Position - mouse.Hit.p).magnitude
  270. local p = Instance.new("Part")
  271. p.CanCollide = false
  272. p.Anchored = false
  273. p.BrickColor = BrickColor.new("Really red")
  274. p.Size = Vector3.new(0.2, 0.2, mag)
  275. smooth(p)
  276. p.Material = "Neon"
  277. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  278. local m = Instance.new("SpecialMesh", p)
  279. m.MeshType = "Brick"
  280. p.Parent = workspace
  281. p.Touched:connect(function(hit)
  282. if gethum(hit) then
  283. for i, v in pairs(hit.Parent:children()) do
  284. if v:IsA("Model") then
  285. v:BreakJoints()
  286. end
  287. local ok = false
  288. for i, e in pairs({
  289. "Right Arm",
  290. "Left Arm",
  291. "Right Leg",
  292. "Left Leg",
  293. "Head",
  294. "Torso",
  295. "HumanoidRootPart"
  296. }) do
  297. if v.Name == e then
  298. ok = true
  299. end
  300. end
  301. if v:IsA("BasePart") and not ok then
  302. fade(v, true)
  303. end
  304. end
  305. end
  306. if hit:FindFirstChildOfClass("TouchTransmitter") then
  307. hit:FindFirstChildOfClass("TouchTransmitter"):Destroy()
  308. end
  309. end)
  310. local bp = Instance.new("BodyPosition", p)
  311. bp.MaxForce = huge
  312. bp.Position = p.Position
  313. local saved = p.CFrame
  314. for i = 1, 10 do
  315. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  316. p.CFrame = saved
  317. p.Velocity = Vector3.new(0, 0, 100)
  318. p.Transparency = p.Transparency + 0.1
  319. wait()
  320. end
  321. p:Destroy()
  322. end
  323. if key == "e" then
  324. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  325. local mag = (gun.Position - mouse.Hit.p).magnitude
  326. local p = Instance.new("Part")
  327. p.CanCollide = false
  328. p.Anchored = false
  329. p.BrickColor = BrickColor.new("New Yeller")
  330. p.Size = Vector3.new(0.2, 0.2, mag)
  331. smooth(p)
  332. p.Material = "Neon"
  333. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  334. local m = Instance.new("SpecialMesh", p)
  335. m.MeshType = "Brick"
  336. p.Parent = workspace
  337. p.Touched:connect(function(hit)
  338. if gethum(hit) then
  339. local target = game.Players:FindFirstChild(hit.Parent.Name)
  340. if target then
  341. KICK(target)
  342. end
  343. end
  344. end)
  345. local bp = Instance.new("BodyPosition", p)
  346. bp.MaxForce = huge
  347. bp.Position = p.Position
  348. local saved = p.CFrame
  349. for i = 1, 10 do
  350. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  351. p.CFrame = saved
  352. p.Velocity = Vector3.new(0, 0, 100)
  353. p.Transparency = p.Transparency + 0.1
  354. wait()
  355. end
  356. p:Destroy()
  357. end
  358. if key == "r" then
  359. local cf = gun.CFrame * CFrame.new(0, 0, 0.958)
  360. local mag = (gun.Position - mouse.Hit.p).magnitude
  361. local p = Instance.new("Part")
  362. p.CanCollide = false
  363. p.Anchored = false
  364. p.BrickColor = BrickColor.new("Lime green")
  365. p.Size = Vector3.new(0.2, 0.2, mag)
  366. smooth(p)
  367. p.Material = "Neon"
  368. p.CFrame = CFrame.new(gun.Position, mouse.Hit.p) * CFrame.new(0, 0, -mag / 2)
  369. local m = Instance.new("SpecialMesh", p)
  370. m.MeshType = "Brick"
  371. p.Parent = workspace
  372. p.Touched:connect(function(hit)
  373. local hum = gethum(hit)
  374. if hum then
  375. hum.Health = hum.MaxHealth
  376. end
  377. end)
  378. local bp = Instance.new("BodyPosition", p)
  379. bp.MaxForce = huge
  380. bp.Position = p.Position
  381. local saved = p.CFrame
  382. for i = 1, 10 do
  383. p.Size = p.Size + Vector3.new(0.01, 0.01, 0.01)
  384. p.CFrame = saved
  385. p.Velocity = Vector3.new(0, 0, 100)
  386. p.Transparency = p.Transparency + 0.1
  387. wait()
  388. end
  389. p:Destroy()
  390. end
  391. end)
  392. game:GetService("RunService").Stepped:connect(function()
  393. local x, z
  394. local dir = CFrame.new(char.HumanoidRootPart.Position, mouse.Hit.p).lookVector
  395. x = dir.X
  396. z = dir.Z
  397. local cf = CFrame.new(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position + Vector3.new(x, 0, z))
  398. char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame:Lerp(cf, 0.5)
  399. humanoid.AutoRotate = false
  400. end)
  401. while wait() do
  402. if animpose == "Walking" and cananim and legs then
  403. for i = 0, 0.7, 0.1 do
  404. if animpose == "Walking" and cananim and legs then
  405. 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)
  406. 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)
  407. 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)
  408. 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)
  409. 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)
  410. 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)
  411. wait()
  412. else
  413. break
  414. end
  415. end
  416. for i = 0, 0.7, 0.1 do
  417. if animpose == "Walking" and cananim and legs then
  418. 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)
  419. 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)
  420. 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)
  421. 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)
  422. 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)
  423. 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)
  424. wait()
  425. else
  426. break
  427. end
  428. end
  429. end
  430. if animpose == "Idle" and cananim and legs then
  431. 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)
  432. 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)
  433. 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)
  434. 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)
  435. 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)
  436. 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)
  437. end
  438. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement