Advertisement
cubanmixed2

Golden Gun FE

Dec 18th, 2018
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. local RealPlayer = Player
  6. do print("FE Compatibility code by Mokiros")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
  7. --nobody wanted to make a golden gun that I wanted... so I made one :D script made by sillynoob7
  8. function sandbox(var,func)
  9. local env = getfenv(func)
  10. local newenv = setmetatable({},{
  11. __index = function(self,k)
  12. if k=="script" then
  13. return var
  14. else
  15. return env[k]
  16. end
  17. end,
  18. })
  19. setfenv(func,newenv)
  20. return func
  21. end
  22. cors = {}
  23. mas = Instance.new("Model",game:GetService("Lighting"))
  24. Tool0 = Instance.new("Tool")
  25. Part1 = Instance.new("Part")
  26. SpecialMesh2 = Instance.new("SpecialMesh")
  27. Part3 = Instance.new("Part")
  28. BillboardGui4 = Instance.new("BillboardGui")
  29. Script5 = Instance.new("Script")
  30. ImageLabel6 = Instance.new("ImageLabel")
  31. CylinderMesh7 = Instance.new("CylinderMesh")
  32. Part8 = Instance.new("Part")
  33. Weld9 = Instance.new("Weld")
  34. Weld10 = Instance.new("Weld")
  35. Weld11 = Instance.new("Weld")
  36. BlockMesh12 = Instance.new("BlockMesh")
  37. IntValue13 = Instance.new("IntValue")
  38. IntValue14 = Instance.new("IntValue")
  39. StringValue15 = Instance.new("StringValue")
  40. BoolValue16 = Instance.new("BoolValue")
  41. Script17 = Instance.new("Script")
  42. LocalScript18 = Instance.new("LocalScript")
  43. SpecialMesh19 = Instance.new("SpecialMesh")
  44. SpecialMesh20 = Instance.new("SpecialMesh")
  45. LocalScript21 = Instance.new("LocalScript")
  46. LocalScript22 = Instance.new("LocalScript")
  47. LocalScript23 = Instance.new("LocalScript")
  48. LocalScript24 = Instance.new("LocalScript")
  49. ScreenGui25 = Instance.new("ScreenGui")
  50. Frame26 = Instance.new("Frame")
  51. TextButton27 = Instance.new("TextButton")
  52. TextButton28 = Instance.new("TextButton")
  53. TextButton29 = Instance.new("TextButton")
  54. TextButton30 = Instance.new("TextButton")
  55. Script31 = Instance.new("Script")
  56. LocalScript32 = Instance.new("LocalScript")
  57. Sound33 = Instance.new("Sound")
  58. Sound34 = Instance.new("Sound")
  59. StringValue35 = Instance.new("StringValue")
  60. Tool0.Name = "Luger"
  61. Tool0.Parent = mas
  62. Part1.Parent = Tool0
  63. Part1.BrickColor = BrickColor.new("Bright bluish green")
  64. Part1.Anchored = true
  65. Part1.FormFactor = Enum.FormFactor.Custom
  66. Part1.Size = Vector3.new(0.510000467, 1.18000245, 1.34999704)
  67. Part1.CFrame = CFrame.new(6.70000076, 0.590013027, -9.69999599, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  68. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  69. Part1.Position = Vector3.new(6.70000076, 0.590013027, -9.69999599)
  70. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  71. SpecialMesh2.Parent = Part1
  72. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=95356090"
  73. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  74. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=126534866"
  75. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  76. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  77. Part3.Name = "Barrel"
  78. Part3.Parent = Tool0
  79. Part3.BrickColor = BrickColor.new("Really black")
  80. Part3.Transparency = 1
  81. Part3.Rotation = Vector3.new(-90, 0, 0)
  82. Part3.Anchored = true
  83. Part3.FormFactor = Enum.FormFactor.Custom
  84. Part3.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  85. Part3.CFrame = CFrame.new(6.79500008, 0.98001498, -10.4250021, 1, 0, -0, 0, 0, 1, 0, -1, 0)
  86. Part3.BottomSurface = Enum.SurfaceType.Smooth
  87. Part3.TopSurface = Enum.SurfaceType.Smooth
  88. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  89. Part3.Position = Vector3.new(6.79500008, 0.98001498, -10.4250021)
  90. Part3.Orientation = Vector3.new(-90, 0, 0)
  91. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  92. BillboardGui4.Name = "Light"
  93. BillboardGui4.Parent = Part3
  94. BillboardGui4.Size = UDim2.new(1.29999995, 0, 1.29999995, 0)
  95. BillboardGui4.Active = true
  96. BillboardGui4.Adornee = Part3
  97. Script5.Parent = BillboardGui4
  98. table.insert(cors,sandbox(Script5,function()
  99. script.Parent.Adornee = script.Parent.Parent
  100. end))
  101. ImageLabel6.Name = "Light"
  102. ImageLabel6.Parent = BillboardGui4
  103. ImageLabel6.Transparency = 1
  104. ImageLabel6.Size = UDim2.new(1, 0, 1, 0)
  105. ImageLabel6.Visible = false
  106. ImageLabel6.BackgroundColor3 = Color3.new(0.756863, 0.752941, 0.764706)
  107. ImageLabel6.BackgroundTransparency = 1
  108. ImageLabel6.Image = "http://www.roblox.com/asset/?id=42416376"
  109. CylinderMesh7.Parent = Part3
  110. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  111. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  112. Part8.Name = "Handle"
  113. Part8.Parent = Tool0
  114. Part8.BrickColor = BrickColor.new("Black")
  115. Part8.Transparency = 1
  116. Part8.Rotation = Vector3.new(0, 15, 0)
  117. Part8.Anchored = true
  118. Part8.FormFactor = Enum.FormFactor.Custom
  119. Part8.Size = Vector3.new(0.800000012, 0.800000012, 0.800000012)
  120. Part8.CFrame = CFrame.new(6.78499985, 0.468012989, -9.25, 0.965925634, -1.62808846e-07, 0.25881961, 1.62807055e-07, 1, 2.14409219e-08, -0.25881961, 2.14273292e-08, 0.965925634)
  121. Part8.BottomSurface = Enum.SurfaceType.Smooth
  122. Part8.TopSurface = Enum.SurfaceType.Smooth
  123. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  124. Part8.Position = Vector3.new(6.78499985, 0.468012989, -9.25)
  125. Part8.Orientation = Vector3.new(0, 15, 0)
  126. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  127. Weld9.Parent = Part8
  128. Weld9.C0 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  129. Weld9.C1 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  130. Weld9.Part0 = Part8
  131. Weld9.Part1 = Part8
  132. Weld10.Parent = Part8
  133. Weld10.C0 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  134. Weld10.C1 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  135. Weld10.Part0 = Part8
  136. Weld10.Part1 = Part8
  137. Weld11.Parent = Part8
  138. Weld11.C0 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  139. Weld11.C1 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  140. Weld11.Part0 = Part8
  141. Weld11.Part1 = Part8
  142. BlockMesh12.Parent = Part8
  143. BlockMesh12.Offset = Vector3.new(0, 0.00104166672, 0)
  144. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  145. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  146. IntValue13.Name = "Ammo"
  147. IntValue13.Parent = Tool0
  148. IntValue13.Value = 8
  149. IntValue14.Name = "MaxAmmo"
  150. IntValue14.Parent = Tool0
  151. IntValue14.Value = 8
  152. StringValue15.Name = "StringValue"
  153. StringValue15.Parent = Tool0
  154. BoolValue16.Name = "VisibleB"
  155. BoolValue16.Parent = Tool0
  156. Script17.Name = "WeldArm"
  157. Script17.Parent = Tool0
  158. table.insert(cors,sandbox(Script17,function()
  159. Tool = script.Parent
  160.  
  161.  
  162. local arms = nil
  163. local torso = nil
  164. local weld33 = nil -- right arm
  165. local weld55 = nil -- left arm
  166. local welds = {}
  167.  
  168.  
  169.  
  170.  
  171. colors = {26,}
  172.  
  173. function Equip(mouse)
  174. wait(0.01)
  175. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  176. torso = Tool.Parent:FindFirstChild("Torso")
  177. if arms ~= nil and torso ~= nil then
  178. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  179. if sh ~= nil then
  180. local yes = true
  181. if yes then
  182. yes = false
  183. sh[1].Part1 = nil
  184. sh[2].Part1 = nil
  185. local weld1 = Instance.new("Weld") -- left arm
  186. weld55 = weld1
  187. weld1.Part0 = torso
  188. weld1.Parent = torso
  189. weld1.Part1 = arms[1]
  190. weld1.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  191. welds[1] = weld1
  192. local weld2 = Instance.new("Weld") -- right arm
  193. weld33 = weld2
  194. weld2.Part0 = torso
  195. weld2.Parent = torso
  196. weld2.Part1 = arms[2]
  197. weld2.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  198. welds[2] = weld2
  199.  
  200. end
  201. else
  202. print("sh")
  203. end
  204. else
  205. print("arms")
  206. end
  207. end
  208.  
  209. function Unequip(mouse)
  210. if arms ~= nil and torso ~= nil then
  211. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  212. if sh ~= nil then
  213. local yes = true
  214. if yes then
  215. yes = false
  216. sh[1].Part1 = arms[1]
  217. sh[2].Part1 = arms[2]
  218. welds[1].Parent = nil
  219. welds[2].Parent = nil
  220.  
  221. end
  222. else
  223. print("sh")
  224. end
  225. else
  226. print("arms")
  227. end
  228. end
  229. Tool.Equipped:connect(Equip)
  230. Tool.Unequipped:connect(Unequip)
  231. end))
  232. LocalScript18.Name = "Arms"
  233. LocalScript18.Parent = Tool0
  234. table.insert(cors,sandbox(LocalScript18,function()
  235. sp = script.Parent
  236.  
  237. Mesh = false -- If true will load BC 2.0 Arm meshes as well.
  238. Shirt = true -- If true will load the user's shirt to the arms as well
  239.  
  240. function onEquipped(mouse)
  241. local Player = game:GetService("Players").LocalPlayer
  242. local Cam = game.Workspace.CurrentCamera
  243.  
  244. local Arms = Instance.new("Model")
  245. Arms.Name = "Arms"
  246. Arms.Parent = Cam
  247.  
  248. if Shirt == true then
  249. local Humanoid = Instance.new("Humanoid")
  250. Humanoid.MaxHealth = 0
  251. Humanoid.Health = 0
  252. Humanoid.Name = ""
  253. Humanoid.Parent = Arms
  254.  
  255. local newShirt = Player.Character:FindFirstChild("Shirt"):clone()
  256. newShirt.Parent = Arms
  257. else end
  258.  
  259. local RightArm = Player.Character:FindFirstChild("Right Arm"):clone()
  260. RightArm.Name = "Right Arm"
  261. RightArm.Transparency = 0.1
  262.  
  263. local w = Instance.new("Weld")
  264. w.Part0 = RightArm
  265. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  266. w.C0 = CFrame.new()
  267. w.C1 = CFrame.new()
  268. w.Parent = RightArm
  269. RightArm.Parent = Arms
  270.  
  271. local LeftArm = Player.Character:FindFirstChild("Left Arm"):clone()
  272. LeftArm.Name = "Left Arm"
  273. LeftArm.Transparency = 0.1
  274.  
  275. local w = Instance.new("Weld")
  276. w.Part0 = LeftArm
  277. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  278. w.C0 = CFrame.new()
  279. w.C1 = CFrame.new()
  280. w.Parent = LeftArm
  281. LeftArm.Parent = Arms
  282.  
  283. if Mesh ~= false then
  284. local LeftArmMesh = script:FindFirstChild("LeftArm")
  285. LeftArmMesh.Parent = LeftArm
  286. local RightArmMesh = script:FindFirstChild("RightArm")
  287. RightArmMesh.Parent = RightArm
  288. else end
  289.  
  290. end
  291.  
  292. function onUnequipped(mouse)
  293. local Player = game:GetService("Players").LocalPlayer
  294. local Cam = game.Workspace.CurrentCamera
  295. for _, Model in pairs(Cam:GetChildren()) do
  296. if Model.Name == "Arms" then
  297. Model:remove()
  298. else end
  299. end
  300. end
  301.  
  302. sp.Equipped:connect(onEquipped)
  303. sp.Unequipped:connect(onUnequipped)
  304.  
  305. end))
  306. SpecialMesh19.Name = "LeftArm"
  307. SpecialMesh19.Parent = LocalScript18
  308. SpecialMesh19.MeshId = "http://www.roblox.com/asset/?id=27111419"
  309. SpecialMesh19.MeshType = Enum.MeshType.FileMesh
  310. SpecialMesh20.Name = "RightArm"
  311. SpecialMesh20.Parent = LocalScript18
  312. SpecialMesh20.MeshId = "http://www.roblox.com/asset/?id=27111864"
  313. SpecialMesh20.MeshType = Enum.MeshType.FileMesh
  314. LocalScript21.Name = "BackupWeld"
  315. LocalScript21.Parent = Tool0
  316. table.insert(cors,sandbox(LocalScript21,function()
  317. function Weld(x,y)
  318. local W = Instance.new("Weld")
  319. W.Part0 = x
  320. W.Part1 = y
  321. local CJ = CFrame.new(x.Position)
  322. local C0 = x.CFrame:inverse()*CJ
  323. local C1 = y.CFrame:inverse()*CJ
  324. W.C0 = C0
  325. W.C1 = C1
  326. W.Parent = x
  327. end
  328.  
  329. function Get(A)
  330. if A.className == "Part" then
  331. Weld(script.Parent.Handle, A)
  332. A.Anchored = false
  333. else
  334. local C = A:GetChildren()
  335. for i=1, #C do
  336. Get(C[i])
  337. end
  338. end
  339. end
  340.  
  341. function Finale()
  342. Get(script.Parent)
  343. end
  344.  
  345. script.Parent.Equipped:connect(Finale)
  346. script.Parent.Unequipped:connect(Finale)
  347. Finale()
  348. end))
  349. LocalScript22.Name = "Crouch"
  350. LocalScript22.Parent = Tool0
  351. table.insert(cors,sandbox(LocalScript22,function()
  352. on = 0
  353. Tool = script.Parent
  354. welds = {}
  355. sh = {}
  356. arms = nil
  357. torso = nil
  358. f = nil
  359. function Crouch(ison)
  360. if arms == nil and torso == nil then
  361. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  362. torso = Tool.Parent:FindFirstChild("Torso")
  363. end
  364. if arms ~= nil and torso ~= nil then
  365. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  366. if sh ~= nil then
  367. local yes = true
  368. if yes then
  369. yes = false
  370. if ison == 1 then
  371. sh[1].Part1 = nil
  372. sh[2].Part1 = nil
  373. local weld1 = Instance.new("Weld")
  374. weld1.Part0 = torso
  375. weld1.Parent = torso
  376. weld1.Part1 = arms[1]
  377. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  378. arms[1].Name = "LDave"
  379. arms[1].CanCollide = true
  380. welds[1] = weld1
  381. Tool.Parent.Humanoid.WalkSpeed = 10
  382. -------------------------------------------
  383. local weld2 = Instance.new("Weld")
  384. weld2.Part0 = torso
  385. weld2.Parent = torso
  386. weld2.Part1 = arms[2]
  387. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  388. arms[2].Name = "RDave"
  389. arms[2].CanCollide = true
  390. welds[2] = weld2
  391. ---------------------------------
  392. local force = Instance.new("BodyForce")
  393. force.Parent = torso
  394. f = force
  395. wait(0.01)
  396. elseif ison == 0 then
  397. if arms then
  398. sh[1].Part1 = arms[1]
  399. sh[2].Part1 = arms[2]
  400. f.Parent = nil
  401. arms[2].Name = "Right Leg"
  402. arms[1].Name = "Left Leg"
  403. welds[1].Parent = nil
  404. welds[2].Parent = nil
  405. Tool.Parent.Humanoid.WalkSpeed = 16
  406. end
  407. end
  408. --
  409. end
  410. else
  411. print("sh")
  412. end
  413. else
  414. print("arms")
  415. end
  416. end
  417. function Key(key)
  418. if key then
  419. key = string.lower(key)
  420. if (key=="c") then
  421. if on == 1 then
  422. on = 0
  423. elseif on == 0 then
  424. on = 1
  425. end
  426. Crouch(on)
  427. end
  428. end
  429. end
  430. function Equip(mouse)
  431. mouse.KeyDown:connect(Key)
  432. end
  433. script.Parent.Equipped:connect(Equip)
  434.  
  435.  
  436. end))
  437. LocalScript23.Name = "Crouch/Patrol"
  438. LocalScript23.Parent = Tool0
  439. table.insert(cors,sandbox(LocalScript23,function()
  440. --Note this must be used with the accompanying weld script
  441. --This is an edited version of my V3 KeyCommand Script.
  442. --Heavily edited from a free model crouch script, ~ukwarrior6~
  443.  
  444. ----------------------------
  445. --Crouch and Patrol Script--
  446. ----------------------------
  447.  
  448. on = 0
  449. Tool = script.Parent
  450. welds = {}
  451. sh = {}
  452. arms = nil
  453. torso = nil
  454. f = nil
  455. Holstered = false
  456. wait()
  457. local Tool = script.Parent
  458. enabled = true
  459.  
  460. function Crouch(ison)
  461. if arms == nil and torso == nil then
  462. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  463. torso = Tool.Parent:FindFirstChild("Torso")
  464. end
  465. if arms ~= nil and torso ~= nil then
  466. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  467. if sh ~= nil then
  468. local yes = true
  469. if yes then
  470. yes = false
  471. if ison == 1 then
  472. sh[1].Part1 = nil
  473. sh[2].Part1 = nil
  474. local weld1 = Instance.new("Weld")
  475. weld1.Part0 = torso
  476. weld1.Parent = torso
  477. weld1.Part1 = arms[1]
  478. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  479. arms[1].Name = "LDave"
  480. arms[1].CanCollide = true
  481. welds[1] = weld1
  482. -------------------------------------------
  483. local weld2 = Instance.new("Weld")
  484. weld2.Part0 = torso
  485. weld2.Parent = torso
  486. weld2.Part1 = arms[2]
  487. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  488. arms[2].Name = "RDave"
  489. arms[2].CanCollide = true
  490. welds[2] = weld2
  491. ---------------------------------
  492. local force = Instance.new("BodyForce")
  493. force.Parent = torso
  494. f = force
  495. wait(0.01)
  496. elseif ison == 0 then
  497. if arms then
  498. sh[1].Part1 = arms[1]
  499. sh[2].Part1 = arms[2]
  500. f.Parent = nil
  501. arms[2].Name = "Right Leg"
  502. arms[1].Name = "Left Leg"
  503. welds[1].Parent = nil
  504. welds[2].Parent = nil
  505. end
  506. end
  507. --
  508. end
  509. else
  510. print("sh")
  511. end
  512. else
  513. print("arms")
  514. end
  515. end
  516. ----------------------------------------------------------------------------------------------------------------
  517. function GunUp()
  518. Holstered = false
  519. Tool.Enabled = true
  520. torso = Tool.Parent:FindFirstChild("Torso")
  521. if torso ~= nil then
  522. torso.weld1.C1 = CFrame.new(0.7, 0.9, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(28), math.rad(-1))
  523. torso.weld2.C1 = CFrame.new(-0.6, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-0.01), 0)
  524. end
  525. end
  526.  
  527. function GunDown()
  528. Holstered = true
  529. Tool.Enabled = false -- You don't want to be shooting if your not aiming
  530. torso = Tool.Parent:FindFirstChild("Torso")
  531. if torso ~= nil then
  532. torso.weld1.C1 = CFrame.new(0.5,0,.5) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-40))
  533. torso.weld2.C1 = CFrame.new(-.8, -0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(-60), 0)
  534. end
  535. end
  536. -----------------------------------------------------------------------------------------------------------------
  537. function onEquippedLocal(mouse)
  538. mouse.Icon = "" -- Chuck in a cool crosshair here..
  539. mouse.KeyDown:connect(onKeyDown)
  540. end
  541. -----------------------------------------------------------------------------------------------------------------
  542. function onKeyDown(key)
  543. if (key~=nil) then
  544. key = key:lower()
  545.  
  546. if (key=="c") then -- Toggle Crouch (For some reason it breaks if you patrol first, working on this...
  547. if on == 1 then
  548. on = 0
  549. elseif on == 0 then
  550. on = 1
  551. end
  552. Crouch(on)
  553.  
  554. elseif (key=="e") then -- Toggle Patrol
  555. if Holstered == true then
  556. script.Parent.Parent.Humanoid.WalkSpeed = 16
  557. GunUp()
  558. elseif Holstered == false then
  559. script.Parent.Parent.Humanoid.WalkSpeed = 20
  560. GunDown()
  561. end end end end
  562. Tool.Equipped:connect(onEquippedLocal)
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569. end))
  570. LocalScript24.Name = "GuiScript"
  571. LocalScript24.Parent = Tool0
  572. table.insert(cors,sandbox(LocalScript24,function()
  573. local Tool = script.Parent
  574.  
  575. local vPlayer
  576. local Gui
  577. local Alt
  578. local Coords
  579. local Ammo
  580. local ready = false
  581.  
  582.  
  583. function setUpGui()
  584. if vPlayer == nil or vPlayer:findFirstChild("PlayerGui") == nil then
  585. return
  586. end
  587.  
  588. Gui = script.ScreenGui:Clone()
  589. Gui.Name = "GunDisplay"
  590. Gui.Parent = vPlayer.PlayerGui
  591. end
  592.  
  593. function onEquippedLocal(mouse)
  594. vPlayer = game.Players.LocalPlayer
  595.  
  596. setUpGui()
  597. ready = false
  598. end
  599.  
  600. function onUnequippedLocal(mouse)
  601. if Gui then
  602. Gui:remove()
  603. end
  604.  
  605. Gui = nil
  606. Alt = nil
  607. Coords = nil
  608. Ammo = nil
  609. vPlayer = nil
  610. end
  611.  
  612. Tool.Equipped:connect(onEquippedLocal)
  613. Tool.Unequipped:connect(onUnequippedLocal)
  614.  
  615. while true do
  616. wait()
  617. if Gui then
  618. Gui.Stats.Mode.Text = "Mode: " ..script.Parent.ModeText.Value
  619. Gui.Stats.Ammo.Ammo.Text = ""..math.floor((((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100)).."%"
  620. Gui.Stats.Reload.Text = script.Parent.StringValue.Value
  621. if script.Parent.VisibleB.Value then
  622. Gui.Stats.Reload.Visible = true
  623. else
  624. Gui.Stats.Reload.Visible = false
  625. end
  626. if (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 66 then
  627. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-0,-128,-0)
  628. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 33 then
  629. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-255,-102)
  630. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 0 then
  631. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-51,-0)
  632. end
  633.  
  634. end
  635. end
  636.  
  637. end))
  638. ScreenGui25.Parent = LocalScript24
  639. Frame26.Name = "Stats"
  640. Frame26.Parent = ScreenGui25
  641. Frame26.Transparency = 1
  642. Frame26.Size = UDim2.new(0.200000003, 0, 0.100000001, 0)
  643. Frame26.Position = UDim2.new(0.100000001, 0, 0.649999976, 0)
  644. Frame26.BackgroundTransparency = 1
  645. TextButton27.Name = "Mode"
  646. TextButton27.Parent = Frame26
  647. TextButton27.Transparency = 1
  648. TextButton27.Size = UDim2.new(1, 0, 0.5, 0)
  649. TextButton27.Text = "Mode: Nil"
  650. TextButton27.BackgroundTransparency = 1
  651. TextButton27.Font = Enum.Font.ArialBold
  652. TextButton27.FontSize = Enum.FontSize.Size18
  653. TextButton27.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  654. TextButton28.Name = "Ammo"
  655. TextButton28.Parent = Frame26
  656. TextButton28.Transparency = 1
  657. TextButton28.Size = UDim2.new(1, 0, 0.5, 0)
  658. TextButton28.Text = "Ammo: "
  659. TextButton28.Position = UDim2.new(-0.119999997, 0, 0.5, 0)
  660. TextButton28.BackgroundTransparency = 1
  661. TextButton28.Font = Enum.Font.ArialBold
  662. TextButton28.FontSize = Enum.FontSize.Size18
  663. TextButton28.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  664. TextButton29.Name = "Ammo"
  665. TextButton29.Parent = TextButton28
  666. TextButton29.Transparency = 1
  667. TextButton29.Size = UDim2.new(1, 0, 1, 0)
  668. TextButton29.Text = "90%"
  669. TextButton29.Position = UDim2.new(0.699999988, 0, 0, 0)
  670. TextButton29.BackgroundTransparency = 1
  671. TextButton29.Font = Enum.Font.ArialBold
  672. TextButton29.FontSize = Enum.FontSize.Size18
  673. TextButton29.TextColor3 = Color3.new(1, 0.2, 0)
  674. TextButton29.TextXAlignment = Enum.TextXAlignment.Left
  675. TextButton30.Name = "Reload"
  676. TextButton30.Parent = Frame26
  677. TextButton30.Transparency = 1
  678. TextButton30.Size = UDim2.new(1, 0, 0.5, 0)
  679. TextButton30.Text = "Reloading"
  680. TextButton30.Position = UDim2.new(0, 0, 1, 0)
  681. TextButton30.Visible = false
  682. TextButton30.BackgroundTransparency = 1
  683. TextButton30.Font = Enum.Font.ArialBold
  684. TextButton30.FontSize = Enum.FontSize.Size18
  685. TextButton30.TextColor3 = Color3.new(1, 0.2, 0)
  686. TextButton30.TextTransparency = 1.8000003099442
  687. Script31.Name = "Flash"
  688. Script31.Parent = TextButton30
  689. table.insert(cors,sandbox(Script31,function()
  690. while true do wait()
  691. for i=1,5 do
  692. script.Parent.TextTransparency = script.Parent.TextTransparency + 0.1
  693. wait(0.05)
  694. end
  695. wait(0.1)
  696. for i=1,5 do
  697. script.Parent.TextTransparency = script.Parent.TextTransparency - 0.1
  698. wait(0.05)
  699. end
  700. end
  701.  
  702. end))
  703. LocalScript32.Name = "MainScript"
  704. LocalScript32.Parent = Tool0
  705. table.insert(cors,sandbox(LocalScript32,function()
  706. wait(1)
  707. local Tool = script.Parent;
  708. local pewsound
  709. local bangsound
  710. local cam
  711. local ggui
  712.  
  713. enabled = true
  714. automatichold = false
  715. dmged = false
  716. shotgun = false
  717. equipped = false
  718. overheated = false
  719. isZoom = false
  720.  
  721. -----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
  722. -----!Instructions!-----
  723. --Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
  724. --Just place this script into any gun and edit the values below.--
  725. --Editting anything else will risk breaking it.--
  726. ------------------------
  727. Damage = 20
  728. SPS = 15 -- Shots Per Second, gives a limit of how fast the gun shoots.
  729. Recoil = 3 -- [1-10] [1 = Minigun, 10 = Sniper]
  730. WallShoot = false -- Shoots through walls.
  731. GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
  732. BulletColor = "Cool yellow" -- Any Brickcolor will work.
  733. Flash = true
  734. --------------------------------------------------------------------------------------------------------
  735.  
  736. local zm = Instance.new("Part")
  737. zm.Name = "ZoomZM"
  738. zm.Anchored = true
  739. zm.Transparency = 1
  740. zm.Size = Vector3.new(1,1,1)
  741. zm.CanCollide = false
  742. GunType = 0
  743.  
  744. --[[local gui = Instance.new("ScreenGui")
  745. local bg = Instance.new("Frame",gui)
  746. local bar = Instance.new("Frame",bg)
  747. local bvl = Instance.new("ImageLabel", bg)
  748. bvl.Name = "Bevel"
  749. bvl.BackgroundTransparency = 1
  750. bvl.Image = "http://www.roblox.com/asset/?id=56852431"
  751. bvl.Size = UDim2.new(1,0,1,0)
  752. bg.Name = "Back"
  753. bar.Name = "Charge"
  754. bar.BackgroundColor3 = Color3.new(200/255,0/255,0/255)
  755. bg.BackgroundColor3 = Color3.new(200/255,200/255,200/255)
  756. bg.Size = UDim2.new(0,10,0,-100)
  757. bg.Position = UDim2.new(0,5,0,500)
  758. bar.Size = UDim2.new(0,4,-1,0)
  759. bar.Position = UDim2.new(0,3,1,0)
  760.  
  761. ggui = gui:Clone()
  762. ggui.Name = "GunGui"
  763. ggui.Back.Charge.Size = UDim2.new(0,4,-(script.Charge.Value/100),0)]]
  764.  
  765. GroupID = 9999
  766.  
  767. function AntiGH(char1,char2)
  768. if GH then
  769. local plyr1 = game.Players:findFirstChild(char1.Name)
  770. local plyr2 = game.Players:findFirstChild(char2.Name)
  771. if plyr1 and plyr2 then
  772. if plyr1:IsInGroup(GroupID) and plyr2:IsInGroup(GroupID) then
  773. return false
  774. end
  775. end
  776. return true
  777. elseif not GH then
  778. return true
  779. end
  780. end
  781.  
  782. MaxDist = 1000
  783.  
  784. function RayCast(Start,End,Ignore)
  785. if WallShoot then
  786. ray1 = Ray.new(Start, End.unit * 999.999)
  787. local Part1, TempPos = Workspace:FindPartOnRay(ray1,Ignore)
  788. ray2 = Ray.new(TempPos, End.unit * 999.999)
  789. local Part2, EndPos = Workspace:FindPartOnRay(ray2,Part1)
  790. return Part1, Part2, EndPos
  791. elseif not WallShoot then
  792. ray = Ray.new(Start, End.unit * 999.999)
  793. return Workspace:FindPartOnRay(ray,Ignore)
  794. end
  795. end
  796.  
  797. function DmgPlr(Part)
  798. if Part ~= nil then
  799. local c = Instance.new("ObjectValue")
  800. c.Name = "creator"
  801. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  802. local hum = Part.Parent:findFirstChild("Humanoid")
  803. local hathum = Part.Parent.Parent:findFirstChild("Humanoid")
  804. local hat = Part.Parent
  805. if hathum ~= nil and hat:IsA("Hat") and AntiGH(hathum.Parent, script.Parent.Parent) then
  806. hathum:TakeDamage(Damage/1)
  807. Part.Parent = game.Workspace
  808. Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
  809. hat:Remove()
  810. c.Parent = hathum
  811. game.Debris:AddItem(c,1.5)
  812. elseif hum ~= nil and AntiGH(hum.Parent, script.Parent.Parent) then
  813. if Part.Name == "Head" then
  814. hum:TakeDamage(Damage*1.3)
  815. end
  816. hum:TakeDamage(Damage)
  817. c.Parent = hum
  818. game.Debris:AddItem(c,1.5)
  819. end
  820. end
  821. end
  822.  
  823. function onButton1Down(mouse)
  824. if script.Parent.Ammo.Value == 0 then
  825. else
  826. if GunType == 0 then
  827. if (not enabled) then return end
  828. enabled = false
  829. LaserShoot(mouse)
  830. if Flash then
  831. script.Parent.Barrel.Light.Light.Visible = true
  832. end
  833. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  834. wait(0.01)
  835. if Flash then
  836. script.Parent.Barrel.Light.Light.Visible = false
  837. end
  838. wait(1/SPS)
  839. enabled = true
  840. elseif GunType == 1 then
  841. automatichold = true
  842. while automatichold == true and script.Parent.Ammo.Value ~= 0 do wait()
  843. if (not enabled) then return end
  844. if script.Parent.Parent:findFirstChild("Humanoid").Health == 0 then script.Parent:Remove() end
  845. enabled = false
  846. LaserShoot(mouse)
  847. if Flash then
  848. script.Parent.Barrel.Light.Light.Visible = true
  849. end
  850. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  851. wait(0.01)
  852. if Flash then
  853. script.Parent.Barrel.Light.Light.Visible = false
  854. end
  855. wait(1/SPS)
  856. enabled = true
  857. end
  858. end
  859. end
  860. end
  861.  
  862. function LaserShoot(mouse)
  863. hit = mouse.Hit.p
  864. local StartPos = script.Parent.Barrel.CFrame.p
  865. local rv = (StartPos-hit).magnitude/(Recoil * 20)
  866. local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
  867. aim = hit + rcl
  868. local P = Instance.new("Part")
  869. P.Name = "Bullet"
  870. P.formFactor = 3
  871. P.BrickColor = BrickColor.new(BulletColor)
  872. P.Size = Vector3.new(1,1,1)
  873. P.Anchored = true
  874. P.CanCollide = false
  875. P.Transparency = 0.5
  876. P.Parent = script.Parent.Parent
  877. local m = Instance.new("CylinderMesh")
  878. m.Name = "Mesh"
  879. m.Parent = P
  880. local c = Instance.new("ObjectValue")
  881. c.Name = "creator"
  882. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  883. pewsound = script:FindFirstChild("Fire")
  884. if pewsound then
  885. pewsound:Play()
  886. end --Brick created. Moving on to next part
  887. local SPos = script.Parent.Barrel.CFrame.p
  888. if WallShoot then
  889. local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  890. DmgPlr(Part1)
  891. DmgPlr(Part2)
  892. if Part1 and Part2 then
  893. local enddist = (EndPos-SPos).magnitude
  894. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
  895. m.Scale = Vector3.new(.04,enddist,.04)
  896. else
  897. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  898. m.Scale = Vector3.new(.04,MaxDist,.04)
  899. end
  900. elseif not WallShoot then
  901. local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  902. DmgPlr(Part)
  903. if Part then
  904. local dist = (Pos-SPos).magnitude
  905. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
  906. m.Scale = Vector3.new(.1,dist,.1)
  907. else
  908. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  909. m.Scale = Vector3.new(.1,MaxDist,.1)
  910. end
  911. end
  912. game.Debris:AddItem(P,.1)
  913. end
  914.  
  915. function onButton1Up(mouse)
  916. automatichold = false
  917. end
  918.  
  919. function onKeyDown(key, mouse)
  920.  
  921.  
  922.  
  923. if key:lower() == "r" then
  924. if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
  925. reloadsound = script:FindFirstChild("Reload")
  926. if reloadsound then
  927. reloadsound:Play()
  928. end
  929. enabled = false
  930. script.Parent.VisibleB.Value = true
  931. script.Parent.StringValue.Value = "Reloading"
  932. repeat script.Parent.StringValue.Value = "Reloading" wait(0.3) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value
  933. script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
  934. wait(0.2)
  935. script.Parent.VisibleB.Value = false
  936. enabled = true
  937. end
  938. end
  939.  
  940. if key:lower() == "m" then
  941. if GunType == 0 then
  942. GunType = 0
  943. Recoil = 3
  944. else
  945. GunType = 1
  946. Recoil = 3
  947. end
  948. end
  949.  
  950. end
  951.  
  952. function onEquipped(mouse)
  953. equipped = true
  954.  
  955. if mouse == nil then
  956. print("Mouse not found")
  957. return
  958. end
  959. mouse.Icon = "http://www.roblox.com/asset/?id=52812029"
  960. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  961. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  962. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  963.  
  964. end
  965.  
  966. function onUnequipped(mouse)
  967. equipped = false
  968. automatichold = false
  969.  
  970.  
  971. end
  972.  
  973. script.Parent.Equipped:connect(onEquipped)
  974. script.Parent.Unequipped:connect(onUnequipped)
  975. while true do wait()
  976. if script.Parent.Ammo.Value == 0 then
  977. script.Parent.VisibleB.Value = true
  978. script.Parent.StringValue.Value = "Reload"
  979. end
  980. if GunType == 1 then
  981. script.Parent.ModeText.Value = "Auto"
  982. else
  983. script.Parent.ModeText.Value = "Semi"
  984. end
  985. end
  986.  
  987.  
  988. end))
  989. Sound33.Name = "Fire"
  990. Sound33.Parent = LocalScript32
  991. Sound33.SoundId = "http://roblox.com/asset/?id=519174837"
  992. Sound33.Volume = 1
  993. Sound34.Name = "Reload"
  994. Sound34.Parent = LocalScript32
  995. Sound34.SoundId = "http://www.roblox.com/asset/?id=519174837"
  996. Sound34.Volume = 1
  997. Sound34.PlayOnRemove = true
  998. StringValue35.Name = "ModeText"
  999. StringValue35.Parent = Tool0
  1000. StringValue35.Value = "Nil"
  1001. for i,v in pairs(mas:GetChildren()) do
  1002. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1003. pcall(function() v:MakeJoints() end)
  1004. end
  1005. mas:Destroy()
  1006. for i,v in pairs(cors) do
  1007. spawn(function()
  1008. pcall(v)
  1009. end)
  1010. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement