Advertisement
Kaemi

golden smg

Mar 22nd, 2018
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.52 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2. --https://paste2.org/C4nabzOx
  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. function sandbox(var,func)
  88. local env = getfenv(func)
  89. local newenv = setmetatable({},{
  90. __index = function(self,k)
  91. if k=="script" then
  92. return var
  93. else
  94. return env[k]
  95. end
  96. end,
  97. })
  98. setfenv(func,newenv)
  99. return func
  100. end
  101. cors = {}
  102. mas = Instance.new("Model",game:GetService("Lighting"))
  103. Tool0 = Instance.new("Tool")
  104. NumberValue1 = Instance.new("NumberValue")
  105. LocalScript2 = Instance.new("LocalScript")
  106. LocalScript3 = Instance.new("LocalScript")
  107. LocalScript4 = Instance.new("LocalScript")
  108. LocalScript5 = Instance.new("LocalScript")
  109. LocalScript6 = Instance.new("LocalScript")
  110. ScreenGui7 = Instance.new("ScreenGui")
  111. Frame8 = Instance.new("Frame")
  112. Frame9 = Instance.new("Frame")
  113. TextLabel10 = Instance.new("TextLabel")
  114. LocalScript11 = Instance.new("LocalScript")
  115. BoolValue12 = Instance.new("BoolValue")
  116. Part13 = Instance.new("Part")
  117. Sound14 = Instance.new("Sound")
  118. Sound15 = Instance.new("Sound")
  119. SpecialMesh16 = Instance.new("SpecialMesh")
  120. Tool0.Name = "Golden Smg"
  121. Tool0.Parent = mas
  122. Tool0.TextureId = "rbxassetid://168510932"
  123. Tool0.GripPos = Vector3.new(0, -0.200000003, 1)
  124. NumberValue1.Name = "Ammo"
  125. NumberValue1.Parent = Tool0
  126. LocalScript2.Name = "BackGun"
  127. LocalScript2.Parent = Tool0
  128. table.insert(cors,sandbox(LocalScript2,function()
  129. --made by alextomcool!!!---Edited by Sparttan.
  130. --to use: put in type of gun: barrel point left, barrel point right or bull-pup(main hande is in the middle of the gun)
  131. --step 2: put in what type of wepoan it is: assult rifle or pistol(there will be more)
  132. --to do list: make it easyer to modife how it weld's.
  133. guntype = 3--1 is assult rifle, 2 is bullpup, 3 is pistol, 4 is knife
  134. weldmode = 2--1 is barrel point upper-left, 2 is barrel pointing upper-right, 3 is barrel point lower-left and 4 is barrel point lower-right
  135. -------(note: if it is pistol or knife then 1 is on right leg, 2 is on left leg, 3 is in the back of your pants and 4 is in the front of your pants)
  136. model = nil--gun model, that is
  137. distance = 0.75--this is the distance between the part(torso/leg) and the gun. DON'T MAKE negitive
  138. rotation = 45--this is the turning in degrees.
  139. --this area is mode more for someone who's already good at gun's. please do not get mad at me if you don't understand what's under here
  140. y = 0--this is what's added to the current y value. positive number's make it go down. negative make's it go up
  141. x = 0--this is what's added to the x value(it's really the z value but it look's like the x value when on your back). positive number's make it go left. negative make's it go right
  142. -------------------------------------------------------------------------------------------------------------------------------------------------------------------
  143. --I suggest not doing anything else under here. All you should have to change is the weldmode and guntype.
  144. --guntype 1 and weldmode 1 is for assault. guntype 3 and weldmode 1 is pistol position.
  145. --Those are what I have done so far so give me time so I can edit them into the correct position.
  146. -------------------------------------------------------------------------------------------------------------------------------------------------------------------
  147. parts = {}
  148. local n = 1
  149. --can i have my
  150. function on(mouse)
  151. if model == nil then
  152. n = 1
  153. local m = Instance.new("Model")
  154. local all = script.Parent:GetChildren()
  155. for i = 1, #all do
  156. if all[i].className == "Part" then
  157. parts[n] = all[i].Transparency
  158. local brick = all[i]:clone()
  159. brick.Parent = m
  160. n = n +1
  161. end
  162. end
  163. wait()
  164. if model == nil then
  165. local weld = script:FindFirstChild("Weld2")
  166. if weld ~= nil then
  167. local new = weld:clone()
  168. new.Disabled = false
  169. new.Parent = m
  170. m.Name = script.Parent.Name
  171. m.Parent = script.Parent.Parent
  172. model = m
  173. local handle = model:FindFirstChild("Handle")
  174. if handle ~= nil then
  175. --------------------------------------------------------------------------------
  176. --------------------------------------------------------------------------------
  177. --------------------------------------------------------------------------------
  178. --------------------------------------------------------------------------------
  179. --------------------------------------------------------------------------------
  180. if guntype == 1 then
  181. local torso = model.Parent:FindFirstChild("Torso")
  182. if torso ~= nil then
  183. if weldmode == 1 then--barrel pointing upper-right
  184. local w = Instance.new("Weld")
  185. w.Part0 = torso
  186. w.Parent = w.Part0
  187. w.Part1 = handle
  188. w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2), 0)
  189. elseif weldmode == 2 then--barrel pointing upper-left
  190. local w = Instance.new("Weld")
  191. w.Part0 = torso
  192. w.Parent = w.Part0
  193. w.Part1 = handle
  194. w.C1 = CFrame.new(distance, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2 ) *-1, 0)
  195. elseif weldmode == 3 then--barrel pointing upside-right
  196. local w = Instance.new("Weld")
  197. w.Part0 = torso
  198. w.Parent = w.Part0
  199. w.Part1 = handle
  200. w.C1 = CFrame.new(distance *-1, -0.1+y, 0.2 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2), -1.5)
  201. elseif weldmode == 4 then--barrel pointing upside-left
  202. local w = Instance.new("Weld")
  203. w.Part0 = torso
  204. w.Parent = w.Part0
  205. w.Part1 = handle
  206. w.C1 = CFrame.new(distance, 0.25+y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2 +rotation) *-1.1, 1)
  207. end
  208. end
  209. --------------------------------------------------------------------------------
  210. --------------------------------------------------------------------------------
  211. --------------------------------------------------------------------------------
  212. --------------------------------------------------------------------------------
  213. --------------------------------------------------------------------------------
  214. elseif guntype == 2 then--BullPup
  215. local torso = model.Parent:FindFirstChild("Torso")
  216. if torso ~= nil then
  217. if weldmode == 1 then--barrel pointing upper-right
  218. local w = Instance.new("Weld")
  219. w.Part0 = torso
  220. w.Parent = w.Part0
  221. w.Part1 = handle
  222. w.C1 = CFrame.new(distance *-1, 0.25+y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2, 0)
  223. elseif weldmode == 2 then--barrel pointing upper-left
  224. local w = Instance.new("Weld")
  225. w.Part0 = torso
  226. w.Parent = w.Part0
  227. w.Part1 = handle
  228. w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2 *-1, 0)
  229. elseif weldmode == 3 then--barrel pointing upside-right
  230. local w = Instance.new("Weld")
  231. w.Part0 = torso
  232. w.Parent = w.Part0
  233. w.Part1 = handle
  234. w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2, 0)
  235. elseif weldmode == 4 then--barrel pointing upside-left
  236. local w = Instance.new("Weld")
  237. w.Part0 = torso
  238. w.Parent = w.Part0
  239. w.Part1 = handle
  240. w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2 *-1, 0)
  241. end
  242. end
  243. --------------------------------------------------------------------------------
  244. --------------------------------------------------------------------------------
  245. --------------------------------------------------------------------------------
  246. --------------------------------------------------------------------------------
  247. --------------------------------------------------------------------------------
  248. elseif guntype == 3 then--pistol
  249. local lleg = model.Parent:FindFirstChild("Left Leg")
  250. local rleg = model.Parent:FindFirstChild("Right Leg")
  251. if lleg ~= nil and rleg ~= nil then
  252. if weldmode == 1 then--pistol on right leg
  253. local w = Instance.new("Weld")
  254. w.Part0 = rleg
  255. w.Parent = w.Part0
  256. w.Part1 = handle
  257. w.C1 = CFrame.new(distance *-1, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
  258. elseif weldmode == 2 then--pistol on left leg
  259. local w = Instance.new("Weld")
  260. w.Part0 = lleg
  261. w.Parent = w.Part0
  262. w.Part1 = handle
  263. w.C1 = CFrame.new(distance, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
  264. elseif weldmode == 3 then--knife in pant's back, gangsta like
  265. local w = Instance.new("Weld")
  266. w.Part0 = torso
  267. w.Parent = w.Part0
  268. w.Part1 = handle
  269. w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2, 0)
  270. elseif weldmode == 4 then--knife in pant's front, gangsta like
  271. local w = Instance.new("Weld")
  272. w.Part0 = torso
  273. w.Parent = w.Part0
  274. w.Part1 = handle
  275. w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2 *-1, 0)
  276. end
  277. end
  278. --------------------------------------------------------------------------------
  279. --------------------------------------------------------------------------------
  280. --------------------------------------------------------------------------------
  281. --------------------------------------------------------------------------------
  282. --------------------------------------------------------------------------------
  283. elseif guntype == 4 then--knife
  284. local lleg = model.Parent:FindFirstChild("Left Leg")
  285. local rleg = model.Parent:FindFirstChild("Right Leg")
  286. local torso = model.Parent:FindFirstChild("Torso")
  287. if lleg ~= nil and rleg ~= nil and torso ~= nil then
  288. if weldmode == 1 then--pistol on right leg
  289. local w = Instance.new("Weld")
  290. w.Part0 = rleg
  291. w.Parent = w.Part0
  292. w.Part1 = handle
  293. w.C1 = CFrame.new(distance *-1, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
  294. elseif weldmode == 2 then--pistol on left leg
  295. local w = Instance.new("Weld")
  296. w.Part0 = lleg
  297. w.Parent = w.Part0
  298. w.Part1 = handle
  299. w.C1 = CFrame.new(distance, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
  300. elseif weldmode == 3 then--knife in pant's back, gangsta like
  301. local w = Instance.new("Weld")
  302. w.Part0 = torso
  303. w.Parent = w.Part0
  304. w.Part1 = handle
  305. w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2, 0)
  306. elseif weldmode == 4 then--knife in pant's front, gangsta like
  307. local w = Instance.new("Weld")
  308. w.Part0 = torso
  309. w.Parent = w.Part0
  310. w.Part1 = handle
  311. w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2 *-1, 0)
  312. end
  313. end
  314. end
  315. end
  316. end
  317. end
  318. end
  319. --------------------------------------------------------------------------------
  320. --------------------------------------------------------------------------------
  321. --------------------------------------------------------------------------------
  322. --------------------------------------------------------------------------------
  323. --------------------------------------------------------------------------------
  324. if model ~= nil then
  325. n = 1
  326. local all = model:GetChildren()
  327. for i = 1, #all do
  328. if all[i].className == "Part" then
  329. all[i].Transparency = 1
  330. end
  331. end
  332. end
  333. end
  334. --check
  335. function off(mouse)
  336. if model ~= nil then
  337. n = 1
  338. local all = model:GetChildren()
  339. for i = 1, #all do
  340. if all[i].className == "Part" then
  341. all[i].Transparency = parts[n]
  342. local Do = true
  343. if Do then
  344. Do = false--dude!
  345. n = n +1
  346. end
  347. end
  348. end
  349. end
  350. end
  351. --please?
  352. script.Parent.Equipped:connect(on)
  353. script.Parent.Unequipped:connect(off)
  354. end))
  355. LocalScript3.Name = "Weld2"
  356. LocalScript3.Parent = LocalScript2
  357. LocalScript3.Disabled = true
  358. table.insert(cors,sandbox(LocalScript3,function()
  359. function Weld(x,y)
  360. local W = Instance.new("Weld")
  361. W.Part0 = x
  362. W.Part1 = y
  363. local CJ = CFrame.new(x.Position)
  364. local C0 = x.CFrame:inverse()*CJ
  365. local C1 = y.CFrame:inverse()*CJ
  366. W.C0 = C0
  367. W.C1 = C1
  368. W.Parent = x
  369. end
  370.  
  371. function Get(A)
  372. if A.className == "Part" then
  373. Weld(script.Parent.Handle, A)
  374. A.Anchored = false
  375. else
  376. local C = A:GetChildren()
  377. for i=1, #C do
  378. Get(C[i])
  379. end
  380. end
  381. end
  382. local yes = true
  383. if yes then
  384. yes = false
  385. Get(script.Parent)
  386. end
  387. function onDied()
  388. script.Parent.Parent = nil
  389. end
  390. h = script.Parent.Parent:FindFirstChild("Humanoid")
  391. if h ~= nil then
  392. h.Died:connect(onDied)
  393. end
  394.  
  395. end))
  396. LocalScript4.Name = "Crouch"
  397. LocalScript4.Parent = Tool0
  398. table.insert(cors,sandbox(LocalScript4,function()
  399. on = 0
  400. Tool = script.Parent
  401. welds = {}
  402. sh = {}
  403. arms = nil
  404. torso = nil
  405. f = nil
  406. function Crouch(ison)
  407. if arms == nil and torso == nil then
  408. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  409. torso = Tool.Parent:FindFirstChild("Torso")
  410. end
  411. if arms ~= nil and torso ~= nil then
  412. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  413. if sh ~= nil then
  414. local yes = true
  415. if yes then
  416. yes = false
  417. if ison == 1 then
  418. sh[1].Part1 = nil
  419. sh[2].Part1 = nil
  420. local weld1 = Instance.new("Weld")
  421. weld1.Part0 = torso
  422. weld1.Parent = torso
  423. weld1.Part1 = arms[1]
  424. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  425. arms[1].Name = "LDave"
  426. arms[1].CanCollide = true
  427. welds[1] = weld1
  428. -------------------------------------------
  429. local weld2 = Instance.new("Weld")
  430. weld2.Part0 = torso
  431. weld2.Parent = torso
  432. weld2.Part1 = arms[2]
  433. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  434. arms[2].Name = "RDave"
  435. arms[2].CanCollide = true
  436. welds[2] = weld2
  437. ---------------------------------
  438. local force = Instance.new("BodyForce")
  439. force.Parent = torso
  440. f = force
  441. wait(0.01)
  442. elseif ison == 0 then
  443. if arms then
  444. sh[1].Part1 = arms[1]
  445. sh[2].Part1 = arms[2]
  446. f.Parent = nil
  447. arms[2].Name = "Right Leg"
  448. arms[1].Name = "Left Leg"
  449. welds[1].Parent = nil
  450. welds[2].Parent = nil
  451. end
  452. end
  453. --
  454. end
  455. else
  456. print("sh")
  457. end
  458. else
  459. print("arms")
  460. end
  461. end
  462. function Key(key)
  463. if key then
  464. key = string.lower(key)
  465. if (key=="c") then
  466. if on == 1 then
  467. on = 0
  468. elseif on == 0 then
  469. on = 1
  470. end
  471. Crouch(on)
  472. end
  473. end
  474. end
  475. function Equip(mouse)
  476. mouse.KeyDown:connect(Key)
  477. end
  478. script.Parent.Equipped:connect(Equip)
  479.  
  480.  
  481. end))
  482. LocalScript5.Name = "InstaWeld"
  483. LocalScript5.Parent = Tool0
  484. table.insert(cors,sandbox(LocalScript5,function()
  485. function Weld(x,y)
  486. local W = Instance.new("Weld")
  487. W.Part0 = x
  488. W.Part1 = y
  489. local CJ = CFrame.new(x.Position)
  490. local C0 = x.CFrame:inverse()*CJ
  491. local C1 = y.CFrame:inverse()*CJ
  492. W.C0 = C0
  493. W.C1 = C1
  494. W.Parent = x
  495. end
  496.  
  497. function Get(A)
  498. if A.className == "Part" then
  499. Weld(script.Parent.Handle, A)
  500. A.Anchored = false
  501. else
  502. local C = A:GetChildren()
  503. for i=1, #C do
  504. Get(C[i])
  505. end
  506. end
  507. end
  508.  
  509. function Finale()
  510. Get(script.Parent)
  511. end
  512.  
  513. script.Parent.Equipped:connect(Finale)
  514. script.Parent.Unequipped:connect(Finale)
  515. Finale()
  516. end))
  517. LocalScript6.Name = "Local Gui"
  518. LocalScript6.Parent = Tool0
  519. table.insert(cors,sandbox(LocalScript6,function()
  520. wait(1)
  521. -------------------------------------Gun info
  522. OriginalToolName = script.Parent.Name
  523. ToolName="Sub_Mach"
  524. ClipSize=30
  525. ReloadTime=3
  526. Firerate=0
  527. MinSpread=.00
  528. MaxSpread=.5
  529. SpreadRate=0
  530. BaseDamage=8000
  531. automatic=true --Machingun
  532. burst=false --Idk!
  533. shot=false --Shotgun
  534. BarrlePos=Vector3.new(4,0.3,0)
  535. Cursors={"rbxasset://textures\\GunCursor.png"}
  536. ReloadCursor="rbxasset://textures\\GunWaitCursor.png"
  537. -------------------------------------
  538. equiped=false
  539. sp=script.Parent
  540. RayLength=3000
  541. Spread=0
  542. enabled=true
  543. reloading=false
  544. down=false
  545. r=game:service("RunService")
  546. last=0
  547. last2=0
  548. last3=0
  549. last4=0
  550. last5=0
  551. last6=0
  552.  
  553. Bullet=Instance.new("Part")
  554. Bullet.Name="Bullet"
  555. Bullet.BrickColor=BrickColor.new("Medium blue")
  556. Bullet.Anchored=true
  557. Bullet.CanCollide=false
  558. Bullet.Locked=true
  559. Bullet.Size=Vector3.new(1,1,1)
  560. Bullet.Transparency=1
  561. Bullet.formFactor=0
  562. Bullet.TopSurface=0
  563. Bullet.BottomSurface=0
  564. mesh=Instance.new("SpecialMesh")
  565. mesh.Parent=Bullet
  566. mesh.MeshType="Brick"
  567. mesh.Name="Mesh"
  568. mesh.Scale=Vector3.new(.15,.15,1)
  569.  
  570. sp.Name = ToolName
  571.  
  572. MaxCharge=100000
  573. Charge=sp.Ammo
  574. cooldownTime = 0.1
  575. overheated = false
  576. overheattime = 6.1
  577. chargeperfireMIN = 1
  578. chargeperfireMAX = 2
  579. player=owner
  580.  
  581. sfx=Instance.new("Sound")
  582. sfx.Name="HitSound"
  583. sfx.Pitch=2
  584. sfx.SoundId="http://www.roblox.com/asset/?id=15666462"
  585. sfx.Volume=0.7
  586. sfx.Looped=false
  587. sfx.PlayOnRemove=false
  588.  
  589.  
  590. function check()
  591. if equiped==true then
  592. if player.PlayerGui:findFirstChild("GunGui") ~= nil then
  593. player.PlayerGui.GunGui.Back.Frame:TweenSize(UDim2.new(Charge.Value/MaxCharge,0,1,0),"In","Linear",0.1)
  594. if overheated == false then
  595. player.PlayerGui.GunGui.Back.Status.Text = Charge.Value.."%"
  596. player.PlayerGui.GunGui.Back.Frame.BackgroundColor3 = Color3.new(256-0, 256-102, 256-255)
  597. --sp.Name=ToolName.." | "..Charge.Value.."%"
  598. end
  599. end
  600. sp.Ammo.Value = Charge.Value
  601. end
  602. end
  603.  
  604. --Ugly, I hate corrotines, oh well :)
  605.  
  606. function recharge()
  607. while true do
  608. wait(cooldownTime)
  609. if down==false then
  610. --if equiped==true then
  611. if overheated == false then
  612. if Charge.Value>0 then
  613. Charge.Value=Charge.Value-2--+math.random(1, 3) --not needed imo
  614. check()
  615. end
  616. end
  617. --end
  618. end
  619. end
  620. end
  621.  
  622. thread=coroutine.create(recharge)
  623. assert(coroutine.resume(thread))
  624.  
  625. function onChargeChanged()
  626. if Charge.Value >= MaxCharge then
  627. Charge.Value = 100
  628. overheated = true
  629. for i = 1, MaxCharge do
  630. wait(overheattime/MaxCharge)
  631. Charge.Value = Charge.Value - 1
  632. if player.PlayerGui:findFirstChild("GunGui") ~= nil and equiped == true then
  633. player.PlayerGui.GunGui.Back.Status.Text = "OVERHEATED"
  634. player.PlayerGui.GunGui.Back.Frame.BackgroundColor3 = Color3.new(256-255, 256-0, 256-0)
  635. --sp.Name=ToolName.." | "..Charge.Value.."%"
  636. end
  637. sp.Ammo.Value = Charge.Value
  638. check()
  639. if Charge.Value==0 then
  640. overheated = false
  641. if player.PlayerGui:findFirstChild("GunGui") ~= nil and equiped == true then
  642. player.PlayerGui.GunGui.Back.Status.Text = Charge.Value.."%"
  643. player.PlayerGui.GunGui.Back.Frame.BackgroundColor3 = Color3.new(256-0, 256-102, 256-255)
  644. --sp.Name=ToolName.." | "..Charge.Value.."%"
  645. end
  646. break
  647. end
  648. end
  649. overheated = false
  650. end
  651.  
  652. if Charge.Value <= 0 then
  653. Charge.Value = 0
  654. if player.PlayerGui:findFirstChild("GunGui") ~= nil then
  655. player.PlayerGui.GunGui.Back.Status.Text = Charge.Value.."%"
  656. player.PlayerGui.GunGui.Back.Frame.BackgroundColor3 = Color3.new(256-0, 256-102, 256-255)
  657. --sp.Name=ToolName.." | "..Charge.Value.."%"
  658. end
  659. end
  660.  
  661. end
  662. sp.Ammo.Changed:connect(onChargeChanged)
  663.  
  664.  
  665. function computeDirection(vec)
  666. local lenSquared = vec.magnitude * vec.magnitude
  667. local invSqrt = 1 / math.sqrt(lenSquared)
  668. return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
  669. end
  670.  
  671. ------------------------------------------------------------------------------------Raycasting functions
  672. function raycast(startp, endp, ign)
  673. local vec=(endp-startp)
  674. if vec.magnitude<1000 then
  675. local hit,pos=game.Workspace:FindPartOnRay(Ray.new(startp,vec),ign)
  676. if hit and pos then
  677. if hit.Parent.className=="Tool" or hit.Parent.className=="Hat" then
  678. if hit.Parent.Parent ~= nil then
  679. if hit.Parent.Parent:findFirstChild("Humanoid")~=nil then
  680. return hit.Parent, pos
  681. end
  682. end
  683. elseif string.lower(hit.Name)=="glass" then
  684. local vec=(endp-pos)
  685. hit,pos=raycast(pos,vec,ign)
  686. elseif string.lower(hit.Name)=="water" then
  687. local vec=(endp-pos)
  688. hit,pos=raycast(pos,vec,ign)
  689. elseif hit.Transparency==1 or hit.Name=="Bullet" or hit.Name=="BulletTexture" then
  690. local vec=(endp-pos)
  691. hit,pos=raycast(pos,vec,hit)
  692. end
  693. end
  694. return hit,pos
  695. end
  696. return nil
  697. end
  698. -------------------------------------------------------------------------------
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705. function tagHumanoid(humanoid)
  706. local plr=game.Players:playerFromCharacter(sp.Parent)
  707. if plr~=nil then
  708. local tag=Instance.new("ObjectValue")
  709. tag.Value=plr
  710. tag.Name="creator"
  711. tag.Parent=humanoid
  712. delay(2,function()
  713. if tag~=nil then
  714. tag.Parent=nil
  715. end
  716. end)
  717. end
  718. end
  719.  
  720. function onKeyDown(key,mouse)
  721. key=key:lower()
  722. --[[if key=="r" and not reloading then
  723. reload(mouse)
  724. end]]
  725. end
  726.  
  727. function movecframe(p,pos)
  728. p.Parent=game.Lighting
  729. p.Position=pos
  730. p.Parent=game.Workspace
  731. end
  732.  
  733. function checkAllyWIJ(killer, victim)
  734. if killer ~= victim then
  735. if killer.TeamColor==BrickColor.new("Bright blue") and victim.TeamColor==BrickColor.new("Bright green") then
  736. return true
  737. elseif killer.TeamColor==BrickColor.new("Bright green") and victim.TeamColor==BrickColor.new("Bright blue") then
  738. return true
  739. elseif killer.TeamColor == victim.TeamColor then
  740. return true
  741. else
  742. return false
  743. end
  744. return false
  745. else
  746. return true
  747. end
  748. return false
  749. end
  750. function fire(aim)
  751. script.Parent.Handle.Fire.Pitch=(math.random(-5,5)/10)+1
  752. sp.Handle.Fire:Play()
  753.  
  754. t=r.Stepped:wait()
  755. last6=last5
  756. last5=last4
  757. last4=last3
  758. last3=last2
  759. last2=last
  760. last=t
  761.  
  762. local bullet=Bullet:clone()
  763. --[[local bt2=game.Lighting.BulletTexture:clone()
  764. bt2.BrickColor=BrickColor.new("Bright red")
  765. bt2.Mesh.Scale=Vector3.new(.5,.5,2)]]--
  766. local totalDist=0
  767. Lengthdist=-RayLength/.5
  768. local startpoint=sp.Handle.CFrame*BarrlePos
  769. local direction=(aim-startpoint)
  770. local cfrm=CFrame.new(startpoint, direction+startpoint)
  771. local vector=startpoint+(direction.Unit*999)
  772. if (startpoint-vector).magnitude<1000 then
  773. if game.Workspace:FindPartOnRay(Ray.new(player.Character.Head.Position,startpoint-player.Character.Head.Position),player.Character)==nil then
  774. local hit,pos=raycast(startpoint,vector,player.Character)
  775. bullet.Parent=game.Workspace
  776. --bt2.Parent=game.Workspace
  777. if hit~=nil then
  778. local humanoid=hit.Parent:FindFirstChild("Humanoid")
  779. if humanoid~=nil then
  780. local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
  781. if hit.Name=="Head" then
  782. damage=damage*1.25
  783. elseif hit.Name=="Torso" then
  784. else
  785. damage=damage*.75
  786. end
  787. if humanoid.Health>0 then
  788. local eplr=game.Players:playerFromCharacter(humanoid.Parent)
  789. local plr=game.Players:playerFromCharacter(sp.Parent)
  790. if eplr~=nil and plr~=nil then
  791. if (checkAllyWIJ(plr, eplr)==false) then
  792. tagHumanoid(humanoid)
  793. humanoid.Parent:BreakJoints()
  794. sX=sfx:clone()
  795. sX.Parent=player
  796. sX:play()
  797. end
  798. else
  799. tagHumanoid(humanoid)
  800. humanoid:TakeDamage(damage)
  801. sX=sfx:clone()
  802. sX.Parent=player
  803. sX:play()
  804. end
  805. end
  806. end
  807. if (hit.Name == "Part10") or (hit.Name == "Part11") or (hit.Name == "Part21") or (hit.Name == "Part23") or (hit.Name == "Part24") or (hit.Name == "Part8") then
  808. rand = math.random(1,5)
  809. if rand == 3 then
  810. workspace.GlassSound:play()
  811. hit:breakJoints()
  812. end
  813. end
  814. if (hit.Parent:findFirstChild("Hit")) then
  815. hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/3
  816. end
  817. distance=(startpoint-pos).magnitude
  818. bullet.CFrame=cfrm*CFrame.new(0,0,-distance/2)
  819. bullet.Mesh.Scale=Vector3.new(.15,.15,distance)
  820. else
  821. bullet.CFrame=cfrm*CFrame.new(0,0,-RayLength/2)
  822. bullet.Mesh.Scale=Vector3.new(.15,.15,RayLength)
  823. end
  824. if pos~=nil then
  825. --bt2.CFrame=bullet.CFrame
  826. --movecframe(bt2,pos)
  827. end
  828. local deb=game:FindFirstChild("Debris")
  829. if deb==nil then
  830. local debris=Instance.new("Debris")
  831. debris.Parent=game
  832. end
  833. check()
  834. game.Debris:AddItem(bullet,.05)
  835. game.Debris:AddItem(sX, 1)
  836. --game.Debris:AddItem(bt2,.5)
  837. end
  838. end
  839. end
  840.  
  841. function onButton1Up(mouse)
  842. down=false
  843. end
  844.  
  845. function onButton1Down(mouse)
  846. h=sp.Parent:FindFirstChild("Humanoid")
  847. if not enabled or reloading or down or h==nil or overheated then
  848. return
  849. end
  850. if Charge.Value<MaxCharge and h.Health>0 then
  851. --[[if sp.Ammo.Value<=0 then
  852. if not reloading then
  853. reload(mouse)
  854. end
  855. return
  856. end]]
  857. down=true
  858. enabled=false
  859.  
  860. while down do
  861. if Charge.Value>=MaxCharge or sp.Parent:FindFirstChild("Humanoid")==nil or overheated == true then
  862. break
  863. end
  864. if burst then
  865. local startpoint=sp.Handle.CFrame*BarrlePos
  866. local mag=(mouse.Hit.p-startpoint).magnitude
  867. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  868. fire(mouse.Hit.p+rndm)
  869. Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX)
  870. if Charge.Value>=MaxCharge then
  871. break
  872. end
  873. wait(.05)
  874. local startpoint=sp.Handle.CFrame*BarrlePos
  875. local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
  876. local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2))
  877. fire(mouse.Hit.p+rndm+rndm2)
  878. Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX)
  879. if Charge.Value>=MaxCharge then
  880. break
  881. end
  882. wait(.05)
  883. fire(mouse.Hit.p+rndm+rndm2+rndm2)
  884. Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX)
  885. elseif shot then
  886. Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX)
  887. local startpoint=sp.Handle.CFrame*BarrlePos
  888. local mag=(mouse.Hit.p-startpoint).magnitude
  889. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  890. fire(mouse.Hit.p+rndm)
  891. local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
  892. local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  893. fire(mouse.Hit.p+rndm+rndm2)
  894. local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  895. fire(mouse.Hit.p+rndm+rndm3)
  896. local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  897. fire(mouse.Hit.p+rndm+rndm4)
  898. else
  899. Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX)
  900. local startpoint=sp.Handle.CFrame*BarrlePos
  901. local mag=(mouse.Hit.p-startpoint).magnitude
  902. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  903. fire(mouse.Hit.p+rndm)
  904. end
  905. wait(Firerate)
  906. if not automatic then
  907. break
  908. end
  909. end
  910. enabled=true
  911. else
  912. sp.Handle.Trigger:Play()
  913. end
  914. end
  915.  
  916. function onEquippedLocal(mouse)
  917. if mouse==nil then
  918. print("Mouse not found")
  919. return
  920. end
  921. script.GunGui:clone().Parent=player.PlayerGui
  922. mouse.Icon=Cursors[1]
  923. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  924. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  925. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  926. check()
  927. equiped=true
  928. if #Cursors>1 then
  929. while equiped do
  930. t=r.Stepped:wait()
  931. local action=sp.Parent:FindFirstChild("Pose")
  932. if action~=nil then
  933. if sp.Parent.Pose.Value=="Standing" then
  934. Spread=MinSpread
  935. else
  936. Spread=MinSpread+((4/10)*(MaxSpread-MinSpread))
  937. end
  938. else
  939. Spread=MinSpread
  940. end
  941. if t-last<SpreadRate then
  942. Spread=Spread+.1*(MaxSpread-MinSpread)
  943. end
  944. if t-last2<SpreadRate then
  945. Spread=Spread+.1*(MaxSpread-MinSpread)
  946. end
  947. if t-last3<SpreadRate then
  948. Spread=Spread+.1*(MaxSpread-MinSpread)
  949. end
  950. if t-last4<SpreadRate then
  951. Spread=Spread+.1*(MaxSpread-MinSpread)
  952. end
  953. if t-last5<SpreadRate then
  954. Spread=Spread+.1*(MaxSpread-MinSpread)
  955. end
  956. if t-last6<SpreadRate then
  957. Spread=Spread+.1*(MaxSpread-MinSpread)
  958. end
  959. if not reloading then
  960. local percent=(Spread-MinSpread)/(MaxSpread-MinSpread)
  961. for i=0,#Cursors-1 do
  962. if percent>(i/(#Cursors-1))-((1/(#Cursors-1))/2) and percent<(i/(#Cursors-1))+((1/(#Cursors-1))/2) then
  963. mouse.Icon=Cursors[i+1]
  964. end
  965. end
  966. end
  967. wait(Firerate*.9)
  968. end
  969. end
  970. end
  971. function onUnequippedLocal(mouse)
  972. if player.PlayerGui:FindFirstChild("GunGui")~=nil then
  973. player.PlayerGui:FindFirstChild("GunGui").Parent=nil
  974. end
  975. equiped=false
  976. reloading=false
  977. sp.Name = OriginalToolName
  978. end
  979. sp.Equipped:connect(onEquippedLocal)
  980. sp.Unequipped:connect(onUnequippedLocal)
  981. check()
  982.  
  983. end))
  984. ScreenGui7.Name = "GunGui"
  985. ScreenGui7.Parent = LocalScript6
  986. Frame8.Name = "Back"
  987. Frame8.Parent = ScreenGui7
  988. Frame8.Transparency = 0.20000000298023
  989. Frame8.Size = UDim2.new(0, 400, 0, 25)
  990. Frame8.Style = Enum.FrameStyle.RobloxRound
  991. Frame8.Position = UDim2.new(0.5, -200, 0.75, 0)
  992. Frame8.Active = true
  993. Frame8.Visible = false
  994. Frame8.BackgroundColor3 = Color3.new(0, 0.4, 0.8)
  995. Frame8.BackgroundTransparency = 0.20000000298023
  996. Frame9.Parent = Frame8
  997. Frame9.Transparency = 0.20000000298023
  998. Frame9.Size = UDim2.new(0, 0, 1, 0)
  999. Frame9.BackgroundColor3 = Color3.new(1, 0, 0)
  1000. Frame9.BackgroundTransparency = 0.20000000298023
  1001. Frame9.BorderSizePixel = 0
  1002. TextLabel10.Name = "Status"
  1003. TextLabel10.Parent = Frame8
  1004. TextLabel10.Transparency = 1
  1005. TextLabel10.Size = UDim2.new(0, 100, 0.600000024, 0)
  1006. TextLabel10.Text = "0%"
  1007. TextLabel10.BackgroundTransparency = 1
  1008. TextLabel10.BorderSizePixel = 0
  1009. TextLabel10.TextColor3 = Color3.new(1, 1, 1)
  1010. TextLabel10.TextXAlignment = Enum.TextXAlignment.Left
  1011. LocalScript11.Name = "LocalMelee"
  1012. LocalScript11.Parent = Tool0
  1013. table.insert(cors,sandbox(LocalScript11,function()
  1014. --[[
  1015.  
  1016. Dax,
  1017.  
  1018. See the MeleeScript.
  1019.  
  1020. ]]
  1021.  
  1022. local canmelee = true;
  1023. local tool = script.Parent;
  1024.  
  1025. function onKeyDown(key)
  1026. key:lower();
  1027. if key == "v" then
  1028. if canmelee == false then
  1029. return;
  1030. end
  1031.  
  1032. tool.Melee:play()
  1033.  
  1034. canmelee = false;
  1035.  
  1036. local rgrip = tool.Parent["Right Arm"].RightGrip;
  1037.  
  1038. script.melee.Value = true;
  1039.  
  1040. for i = 1,6 do
  1041. rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(-0.55,0,0);
  1042. wait();
  1043. end
  1044.  
  1045. wait(0.25);
  1046.  
  1047. for i = 1, 6 do
  1048. rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(0.55,0,0);
  1049. wait();
  1050. end
  1051.  
  1052. script.melee.Value = false;
  1053.  
  1054. wait(0.5);
  1055.  
  1056. canmelee = true;
  1057. end
  1058. end
  1059.  
  1060. function onSelect(mouse)
  1061. mouse.KeyDown:connect(onKeyDown);
  1062. end
  1063.  
  1064.  
  1065. function blow(hit)
  1066. local humanoid = hit.Parent:findFirstChild("Humanoid")
  1067. if not humanoid then return end
  1068. local vCharacter = Tool.Parent
  1069. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  1070. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  1071. if humanoid ~= hum and hum ~= nil and game.Players:playerFromCharacter(humanoid.Parent) and game.Players:playerFromCharacter(humanoid.Parent).TeamColor~=cc then
  1072. tagHumanoid(humanoid, vPlayer)
  1073. humanoid:TakeDamage(300)
  1074. wait(1)
  1075. untagHumanoid(humanoid)
  1076. end
  1077. end
  1078.  
  1079.  
  1080. tool.Equipped:connect(onSelect);
  1081. end))
  1082. BoolValue12.Name = "melee"
  1083. BoolValue12.Parent = LocalScript11
  1084. Part13.Name = "Handle"
  1085. Part13.Parent = Tool0
  1086. Part13.Material = Enum.Material.Metal
  1087. Part13.BrickColor = BrickColor.new("Gold")
  1088. Part13.Rotation = Vector3.new(-180, 0, -180)
  1089. Part13.Anchored = true
  1090. Part13.CanCollide = false
  1091. Part13.FormFactor = Enum.FormFactor.Custom
  1092. Part13.Size = Vector3.new(0.283332497, 1.69999504, 3.1166575)
  1093. Part13.CFrame = CFrame.new(-10.4149761, 0.850004494, 42.8024406, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  1094. Part13.BottomSurface = Enum.SurfaceType.Smooth
  1095. Part13.TopSurface = Enum.SurfaceType.Smooth
  1096. Part13.Color = Color3.new(0.937255, 0.721569, 0.219608)
  1097. Part13.Position = Vector3.new(-10.4149761, 0.850004494, 42.8024406)
  1098. Part13.Orientation = Vector3.new(0, 180, 0)
  1099. Part13.Color = Color3.new(0.937255, 0.721569, 0.219608)
  1100. Sound14.Name = "Fire"
  1101. Sound14.Parent = Part13
  1102. Sound14.Pitch = 1.1000000238419
  1103. Sound14.SoundId = "rbxassetid://165946560"
  1104. Sound14.Volume = 1
  1105. Sound15.Name = "Reload"
  1106. Sound15.Parent = Part13
  1107. Sound15.SoundId = "http://www.roblox.com/asset/?id=2697432"
  1108. Sound15.Volume = 1
  1109. SpecialMesh16.Parent = Part13
  1110. SpecialMesh16.MeshId = "rbxassetid://666515963"
  1111. SpecialMesh16.Scale = Vector3.new(0.566664994, 0.566664994, 0.566664994)
  1112. SpecialMesh16.VertexColor = Vector3.new(9, 9, 9)
  1113. SpecialMesh16.MeshType = Enum.MeshType.FileMesh
  1114. SpecialMesh16.Scale = Vector3.new(0.566664994, 0.566664994, 0.566664994)
  1115. for i,v in pairs(mas:GetChildren()) do
  1116. v.Parent = owner.Backpack
  1117. pcall(function() v:MakeJoints() end)
  1118. end
  1119. mas:Destroy()
  1120. for i,v in pairs(cors) do
  1121. spawn(function()
  1122. pcall(v)
  1123. end)
  1124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement