Advertisement
Blitz_lepro

gear giver

Aug 11th, 2023
5,950
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.76 KB | None | 1 1
  1. --Made by N3xul
  2. local runDummyScript = function(f,scri)
  3. local oldenv = getfenv(f)
  4. local newenv = setmetatable({}, {
  5. __index = function(_, k)
  6. if k:lower() == 'script' then
  7. return scri
  8. else
  9. return oldenv[k]
  10. end
  11. end
  12. })
  13. setfenv(f, newenv)
  14. ypcall(function() f() end)
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. mas.Name = "CompiledModel"
  19. o1 = Instance.new("Tool")
  20. o2 = Instance.new("Part")
  21. o3 = Instance.new("SpecialMesh")
  22. o4 = Instance.new("Sound")
  23. o5 = Instance.new("Sound")
  24. o6 = Instance.new("PointLight")
  25. o8 = Instance.new("LocalScript")
  26. o9 = Instance.new("Sound")
  27. o10 = Instance.new("LocalScript")
  28. o11 = Instance.new("Script")
  29. o1.Name = "LaserGun"
  30. o1.Parent = mas
  31. o1.TextureId = "http://www.roblox.com/asset?id=13838639"
  32. o1.GripPos = Vector3.new(0, -0.100000001, 0.75)
  33. o1.CanBeDropped = false
  34. o2.Name = "Handle"
  35. o2.Parent = o1
  36. o2.Position = Vector3.new(6.44000006, 0.670018971, 89.4400024)
  37. o2.Rotation = Vector3.new(-180, 0, -180)
  38. o2.CanCollide = false
  39. o2.FormFactor = Enum.FormFactor.Custom
  40. o2.Size = Vector3.new(0.580000222, 1.34000099, 2.48000145)
  41. o2.CFrame = CFrame.new(6.44000006, 0.670018971, 89.4400024, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  42. o2.BottomSurface = Enum.SurfaceType.Smooth
  43. o2.TopSurface = Enum.SurfaceType.Smooth
  44. o2.Position = Vector3.new(6.44000006, 0.670018971, 89.4400024)
  45. o3.Parent = o2
  46. o3.MeshId = "http://www.roblox.com/asset?id=130099641"
  47. o3.Scale = Vector3.new(0.649999976, 0.649999976, 0.649999976)
  48. o3.TextureId = "http://www.roblox.com/asset/?id=130267361"
  49. o3.MeshType = Enum.MeshType.FileMesh
  50. o4.Name = "Fire"
  51. o4.Parent = o2
  52. o4.Pitch = 1.2000000476837
  53. o4.SoundId = "http://www.roblox.com/asset?id=114488148"
  54. o4.Volume = 1
  55. o5.Name = "Reload"
  56. o5.Parent = o2
  57. o5.Pitch = 0.5
  58. o5.SoundId = "http://www.roblox.com/asset?id=94255248"
  59. o6.Parent = o2
  60. o6.Color = Color3.new(1, 0, 0)
  61. o6.Brightness = 4
  62. o6.Range = 6
  63. o8.Name = "ToolScript"
  64. o8.Parent = o1
  65. table.insert(cors,coroutine.create(function()
  66. wait()
  67. runDummyScript(function()
  68. -----------------
  69. --| Constants |--
  70. -----------------
  71.  
  72. local SHOT_SPEED = 100
  73. local SHOT_TIME = 1000
  74.  
  75. local NOZZLE_OFFSET = Vector3.new(0, 0.4, -1.1)
  76.  
  77. -----------------
  78. --| Variables |--
  79. -----------------
  80.  
  81. local PlayersService = Game:GetService('Players')
  82. local DebrisService = Game:GetService('Debris')
  83.  
  84. local Tool = script.Parent
  85. local Handle = Tool:WaitForChild('Handle')
  86.  
  87. local FireSound = Handle:WaitForChild('Fire')
  88. local ReloadSound = Handle:WaitForChild('Reload')
  89. local HitFadeSound = script:WaitForChild('HitFade')
  90.  
  91. local PointLight = Handle:WaitForChild('PointLight')
  92.  
  93. local Character = nil
  94. local Humanoid = nil
  95. local Player = nil
  96.  
  97. local BaseShot = nil
  98.  
  99. -----------------
  100. --| Functions |--
  101. -----------------
  102.  
  103. -- Returns a character ancestor and its Humanoid, or nil
  104. local function FindCharacterAncestor(subject)
  105. if subject and subject ~= Workspace then
  106. local humanoid = subject:FindFirstChild('Humanoid')
  107. if humanoid then
  108. return subject, humanoid
  109. else
  110. return FindCharacterAncestor(subject.Parent)
  111. end
  112. end
  113. return nil
  114. end
  115.  
  116. -- Removes any old creator tags and applies new ones to the specified target
  117. local function ApplyTags(target)
  118. while target:FindFirstChild('creator') do
  119. target.creator:Destroy()
  120. end
  121.  
  122. local creatorTag = Instance.new('ObjectValue')
  123. creatorTag.Value = Player
  124. creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  125.  
  126. local iconTag = Instance.new('StringValue')
  127. iconTag.Value = Tool.TextureId
  128. iconTag.Name = 'icon'
  129.  
  130. iconTag.Parent = creatorTag
  131. creatorTag.Parent = target
  132. DebrisService:AddItem(creatorTag, 4)
  133. end
  134.  
  135. -- Returns all objects under instance with Transparency
  136. local function GetTransparentsRecursive(instance, partsTable)
  137. local partsTable = partsTable or {}
  138. for _, child in pairs(instance:GetChildren()) do
  139. if child:IsA('BasePart') or child:IsA('Decal') then
  140. table.insert(partsTable, child)
  141. end
  142. GetTransparentsRecursive(child, partsTable)
  143. end
  144. return partsTable
  145. end
  146.  
  147. local function SelectionBoxify(instance)
  148. local selectionBox = Instance.new('SelectionBox')
  149. selectionBox.Adornee = instance
  150. selectionBox.Color = BrickColor.new('Really red')
  151. selectionBox.Parent = instance
  152. return selectionBox
  153. end
  154.  
  155. local function Light(instance)
  156. local light = PointLight:Clone()
  157. light.Range = light.Range + 2
  158. light.Parent = instance
  159. end
  160.  
  161. local function FadeOutObjects(objectsWithTransparency, fadeIncrement)
  162. repeat
  163. local lastObject = nil
  164. for _, object in pairs(objectsWithTransparency) do
  165. object.Transparency = object.Transparency + fadeIncrement
  166. lastObject = object
  167. end
  168. wait()
  169. until lastObject.Transparency >= 1 or not lastObject
  170. end
  171.  
  172. local function Dematerialize(character, humanoid, firstPart)
  173. humanoid.WalkSpeed = 0
  174.  
  175. local parts = {}
  176. for _, child in pairs(character:GetChildren()) do
  177. if child:IsA('BasePart') then
  178. child.Anchored = true
  179. table.insert(parts, child)
  180. elseif child:IsA('LocalScript') or child:IsA('Script') then
  181. child:Destroy()
  182. end
  183. end
  184.  
  185. local selectionBoxes = {}
  186.  
  187. local firstSelectionBox = SelectionBoxify(firstPart)
  188. Light(firstPart)
  189. wait(0.05)
  190.  
  191. for _, part in pairs(parts) do
  192. if part ~= firstPart then
  193. table.insert(selectionBoxes, SelectionBoxify(part))
  194. Light(part)
  195. end
  196. end
  197.  
  198. local objectsWithTransparency = GetTransparentsRecursive(character)
  199. FadeOutObjects(objectsWithTransparency, 0.1)
  200.  
  201. wait(0.5)
  202.  
  203. humanoid.Health = 0
  204. DebrisService:AddItem(character, 2)
  205.  
  206. local fadeIncrement = 0.05
  207. Delay(0.2, function()
  208. FadeOutObjects({firstSelectionBox}, fadeIncrement)
  209. if character then
  210. character:Destroy()
  211. end
  212. end)
  213. FadeOutObjects(selectionBoxes, fadeIncrement)
  214. end
  215.  
  216. local function OnTouched(shot, otherPart)
  217. local character, humanoid = FindCharacterAncestor(otherPart)
  218. if character and humanoid and character ~= Character then
  219. ApplyTags(humanoid)
  220. if shot then
  221. local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name)
  222. if hitFadeSound then
  223. hitFadeSound.Parent = humanoid.Torso
  224. hitFadeSound:Play()
  225. end
  226. shot:Destroy()
  227. end
  228. Dematerialize(character, humanoid, otherPart)
  229. end
  230. end
  231.  
  232. local function OnEquipped()
  233. Character = Tool.Parent
  234. Humanoid = Character:WaitForChild('Humanoid')
  235. Player = PlayersService:GetPlayerFromCharacter(Character)
  236. end
  237.  
  238. local function OnActivated()
  239. if Tool.Enabled and Humanoid.Health > 0 then
  240. Tool.Enabled = false
  241.  
  242. FireSound:Play()
  243.  
  244. local handleCFrame = Handle.CFrame
  245. local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET)
  246. local shotCFrame = CFrame.new(firingPoint, Humanoid.TargetPoint)
  247.  
  248. local laserShotClone = BaseShot:Clone()
  249. laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2))
  250. local bodyVelocity = Instance.new('BodyVelocity')
  251. bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED
  252. bodyVelocity.Parent = laserShotClone
  253. laserShotClone.Touched:connect(function(otherPart)
  254. OnTouched(laserShotClone, otherPart)
  255. end)
  256. DebrisService:AddItem(laserShotClone, SHOT_TIME)
  257. laserShotClone.Parent = Tool
  258.  
  259. wait(0) -- FireSound length
  260.  
  261. ReloadSound:Play()
  262. wait(0) -- ReloadSound length
  263.  
  264. Tool.Enabled = true
  265. end
  266. end
  267.  
  268. local function OnUnequipped()
  269.  
  270. end
  271.  
  272. --------------------
  273. --| Script Logic |--
  274. --------------------
  275.  
  276. BaseShot = Instance.new('Part')
  277. BaseShot.Name = 'Effect'
  278. BaseShot.FormFactor = Enum.FormFactor.Custom
  279. BaseShot.Size = Vector3.new(0.2, 0.2, 3)
  280. BaseShot.CanCollide = false
  281. BaseShot.BrickColor = BrickColor.new('Really red')
  282. SelectionBoxify(BaseShot)
  283. Light(BaseShot)
  284. HitFadeSound:Clone().Parent = BaseShot
  285.  
  286. Tool.Equipped:connect(OnEquipped)
  287. Tool.Unequipped:connect(OnUnequipped)
  288. Tool.Activated:connect(OnActivated)
  289. end,o8)
  290. end))
  291. o9.Name = "HitFade"
  292. o9.Parent = o8
  293. o9.SoundId = "http://www.roblox.com/asset?id=130113415"
  294. o10.Name = "MouseIcon"
  295. o10.Parent = o1
  296. table.insert(cors,coroutine.create(function()
  297. wait()
  298. runDummyScript(function()
  299. local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
  300. local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
  301.  
  302. local Tool = script.Parent
  303.  
  304. local Mouse = nil
  305.  
  306. local function UpdateIcon()
  307. if Mouse then
  308. Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
  309. end
  310. end
  311.  
  312. local function OnEquipped(mouse)
  313. Mouse = mouse
  314. UpdateIcon()
  315. end
  316.  
  317. local function OnChanged(property)
  318. if property == 'Enabled' then
  319. UpdateIcon()
  320. end
  321. end
  322.  
  323. Tool.Equipped:connect(OnEquipped)
  324. Tool.Changed:connect(OnChanged)
  325.  
  326. end,o10)
  327. end))
  328. o11.Name = "Shu_hold"
  329. o11.Parent = o1
  330. table.insert(cors,coroutine.create(function()
  331. wait()
  332. runDummyScript(function()
  333. --This script gives you a next-gen hold script better than the current one. You actually hold the barrel parallel to your face. Put it in any gun you want. Original script by Xliver101, Converted to universal script by ToastyToaster.
  334.  
  335. selected = false
  336. RSH, LSH = nil, nil
  337. GRP = nil
  338. RW, LW = Instance.new("Weld"), Instance.new("Weld")
  339. anim = "none"
  340. function WaitForChild(obj, ch_n)
  341. local t = time()
  342. while not obj:FindFirstChild(ch_n) and time() - t < 10 do wait(0.1) end
  343. return obj:FindFirstChild(ch_n)
  344. end
  345. script.Parent.Equipped:connect(function()
  346. if selected then return end
  347. selected = true
  348. player = game.Players:playerFromCharacter(script.Parent.Parent)
  349. local ch = script.Parent.Parent
  350. WaitForChild(ch, "Torso")
  351. RSH = WaitForChild(ch.Torso, "Right Shoulder")
  352. LSH = WaitForChild(ch.Torso, "Left Shoulder")
  353. GRP = WaitForChild(ch["Right Arm"], "RightGrip")
  354. _G.Grip = GRP
  355. --
  356. RSH.Part1 = nil
  357. LSH.Part1 = nil
  358. --
  359. RW.Part0 = ch.Torso
  360. RW.C0 = CFrame.new(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
  361. RW.C1 = CFrame.new(0, 0.5, 0)
  362. RW.Part1 = ch["Right Arm"]
  363. RW.Parent = ch.Torso
  364. _G.R = RW
  365. --
  366. LW.Part0 = ch.Torso
  367. LW.C0 = CFrame.new(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
  368. LW.C1 = CFrame.new(0, 0.5, 0)
  369. LW.Part1 = ch["Left Arm"]
  370. LW.Parent = ch.Torso
  371. _G.L = LW
  372. --
  373. GRP.C0 = CFrame.new(0, -1, -0.5) * CFrame.fromEulerAnglesXYZ(-1.22, -0.45, 0.22)
  374. for i = 0, 1, 0.05 do
  375. wait()
  376. RW.C0 = CFrame.new(1.5, 0.5, 0.25) * CFrame.fromEulerAnglesXYZ(1.3*i, 0, -0.5*i)
  377. LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7*i, 0, 0.8*i)
  378. LW.C1 = CFrame.new(0.3*i, 1+1*i, 0)
  379. end
  380. wait()
  381. local rg = (ch["Right Arm"]:FindFirstChild("RightGrip") or GRP)
  382. if rg ~= GRP then
  383. GRP.Parent = ch["Right Arm"]
  384. rg:remove()
  385. end
  386. end)
  387. script.Parent.Unequipped:connect(function()
  388. selected = false
  389. local pl = player
  390. RW.C0 = CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  391. LW.C0 = CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  392. LW.C1 = CFrame.new(0,0,0)
  393. RW.Parent = nil
  394. LW.Parent = nil
  395. RSH.Part1 = pl.Character["Right Arm"]
  396. LSH.Part1 = pl.Character["Left Arm"]
  397. end)
  398. function armReload()
  399. for i = 0, 1, 0.1 do
  400. wait()
  401. LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3*i, 0, 0.9*i)
  402. LW.C1 = CFrame.new(0.3*i, 1+1*i, 0)
  403. end
  404. end
  405. function gunOut()
  406. for i = 0, 0.3, 0.06 do
  407. wait()
  408. GRP.C0 = CFrame.new(0+i, -1-i, 0+(2*i)) * CFrame.fromEulerAnglesXYZ(-2.22, -0.45, 0.42)
  409. LW.C0 = CFrame.new(-1, 0.5, 0) * CFrame.fromEulerAnglesXYZ(4.2, 0, 2.9)
  410. LW.C1 = CFrame.new(0.8*i, 1.1+i, -0.3)
  411. end
  412. end
  413. function gunReturn()
  414. RW.C0 = CFrame.new(1.5, 0.5, 0.25) * CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
  415. LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
  416. LW.C1 = CFrame.new(0.3, 1+1, 0)
  417. GRP.C0 = CFrame.new(0, -1, -0.5) * CFrame.fromEulerAnglesXYZ(-1.22, -0.45, 0.22)
  418. end
  419. end,o11)
  420. end))
  421. mas.Parent = workspace
  422. mas:MakeJoints()
  423. local mas1 = mas:GetChildren()
  424. for i=1,#mas1 do
  425. mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  426. ypcall(function() mas1[i]:MakeJoints() end)
  427. end
  428. mas:Destroy()
  429. for i=1,#cors do
  430. coroutine.resume(cors[i])
  431. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement