Advertisement
N0ePlox

Gun Plz work

Aug 14th, 2019
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.84 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. UnionOperation1 = Instance.new("UnionOperation")
  21. Sound2 = Instance.new("Sound")
  22. Sound3 = Instance.new("Sound")
  23. Sound4 = Instance.new("Sound")
  24. ManualWeld5 = Instance.new("ManualWeld")
  25. LocalScript6 = Instance.new("LocalScript")
  26. Animation7 = Instance.new("Animation")
  27. Animation8 = Instance.new("Animation")
  28. BoolValue9 = Instance.new("BoolValue")
  29. Script10 = Instance.new("Script")
  30. Script11 = Instance.new("Script")
  31. Script12 = Instance.new("Script")
  32. Script13 = Instance.new("Script")
  33. LocalScript14 = Instance.new("LocalScript")
  34. LocalScript15 = Instance.new("LocalScript")
  35. RemoteEvent16 = Instance.new("RemoteEvent")
  36. RemoteEvent17 = Instance.new("RemoteEvent")
  37. RemoteEvent18 = Instance.new("RemoteEvent")
  38. Part19 = Instance.new("Part")
  39. Script20 = Instance.new("Script")
  40. BillboardGui21 = Instance.new("BillboardGui")
  41. ImageLabel22 = Instance.new("ImageLabel")
  42. Configuration23 = Instance.new("Configuration")
  43. NumberValue24 = Instance.new("NumberValue")
  44. NumberValue25 = Instance.new("NumberValue")
  45. NumberValue26 = Instance.new("NumberValue")
  46. NumberValue27 = Instance.new("NumberValue")
  47. NumberValue28 = Instance.new("NumberValue")
  48. NumberValue29 = Instance.new("NumberValue")
  49. NumberValue30 = Instance.new("NumberValue")
  50. Tool0.Name = "MAC-11"
  51. Tool0.Parent = mas
  52. Tool0.Grip = CFrame.new(0.602584839, 0.164611056, -0.00915747508, -4.37113883e-08, 0, 1, -0.0253309458, 0.999679148, -1.10725096e-09, -0.999679148, -0.0253309458, -4.36973586e-08)
  53. Tool0.GripForward = Vector3.new(-1, 1.10725096e-09, 4.36973586e-08)
  54. Tool0.GripPos = Vector3.new(0.602584839, 0.164611056, -0.00915747508)
  55. Tool0.GripRight = Vector3.new(-4.37113883e-08, -0.0253309458, -0.999679148)
  56. Tool0.GripUp = Vector3.new(0, 0.999679148, -0.0253309458)
  57. UnionOperation1.Name = "Handle"
  58. UnionOperation1.Parent = Tool0
  59. UnionOperation1.CFrame = CFrame.new(7.94717693, 0.789977014, 1.28141236, 2.8306229e-43, -1.15222564e-21, -0.999999642, -2.07722702e-22, 0.999999285, -1.15222543e-21, 0.999999642, 2.07722601e-22, 1.08880891e-42)
  60. UnionOperation1.Orientation = Vector3.new(0, -90, 0)
  61. UnionOperation1.Position = Vector3.new(7.94717693, 0.789977014, 1.28141236)
  62. UnionOperation1.Rotation = Vector3.new(90, -89.9499969, 90)
  63. UnionOperation1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  64. UnionOperation1.Size = Vector3.new(3.35714221, 1.49999988, 0.214285955)
  65. UnionOperation1.BrickColor = BrickColor.new("Dark stone grey")
  66. UnionOperation1.Material = Enum.Material.Metal
  67. UnionOperation1.brickColor = BrickColor.new("Dark stone grey")
  68. Sound2.Name = "Equip"
  69. Sound2.Parent = UnionOperation1
  70. Sound2.SoundId = "rbxassetid://1498950813"
  71. Sound2.Volume = 1
  72. Sound3.Name = "Fire"
  73. Sound3.Parent = UnionOperation1
  74. Sound3.SoundId = "rbxassetid://1112854510"
  75. Sound3.Volume = 10
  76. Sound4.Name = "Hitmark"
  77. Sound4.Parent = UnionOperation1
  78. Sound4.SoundId = "rbxassetid://160432334"
  79. Sound4.Volume = 10
  80. ManualWeld5.Name = "Handle-to-Muzzle Strong Joint"
  81. ManualWeld5.Parent = UnionOperation1
  82. ManualWeld5.C0 = CFrame.new(0.240074679, -0.940510988, -2.31450462, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  83. ManualWeld5.C1 = CFrame.new(0.205812052, -1.42078507, 0.0316591151, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  84. ManualWeld5.Part1 = Part19
  85. ManualWeld5.part1 = Part19
  86. LocalScript6.Parent = Tool0
  87. table.insert(cors,sandbox(LocalScript6,function()
  88. local CanAttack = true
  89.  
  90.  
  91.  
  92.  
  93.  
  94. script.Parent.Activated:connect(function()
  95.  
  96. local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
  97.  
  98.  
  99.  
  100. if CanAttack == true then
  101.  
  102. attack:Play()
  103.  
  104. CanAttack = false
  105.  
  106. wait(0.7)
  107.  
  108. attack:Stop()
  109.  
  110. CanAttack = true
  111.  
  112. script.Parent.CanDamage.Value = true
  113.  
  114. end
  115.  
  116. end)
  117. end))
  118. Animation7.Name = "Attack"
  119. Animation7.Parent = LocalScript6
  120. Animation7.AnimationId = "rbxassetid://3655542892"
  121. Animation8.Name = "Idle"
  122. Animation8.Parent = LocalScript6
  123. Animation8.AnimationId = "rbxassetid://3655548714"
  124. BoolValue9.Name = "CanDamage"
  125. BoolValue9.Parent = Tool0
  126. BoolValue9.Value = true
  127. Script10.Name = "qPerfectionWeld"
  128. Script10.Parent = Tool0
  129. table.insert(cors,sandbox(Script10,function()
  130. -- Created by Quenty (@Quenty, follow me on twitter).
  131. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  132. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  133.  
  134. --[[ INSTRUCTIONS
  135. - Place in the model
  136. - Make sure model is anchored
  137. - That's it. It will weld the model and all children.
  138.  
  139. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  140. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  141. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  142. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  143. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  144. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  145. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  146. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  147.  
  148. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  149. ]]
  150.  
  151. --[[ DOCUMENTATION
  152. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  153. - Will work in PBS servers
  154. - Will work as long as it starts out with the part anchored
  155. - Stores the relative CFrame as a CFrame value
  156. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  157. - Utilizes a recursive algorith to find all parts in the model
  158. - Will reweld on script reparent if the script is initially parented to a tool.
  159. - Welds as fast as possible
  160. ]]
  161.  
  162. -- qPerfectionWeld.lua
  163. -- Created 10/6/2014
  164. -- Author: Quenty
  165. -- Version 1.0.3
  166.  
  167. -- Updated 10/14/2014 - Updated to 1.0.1
  168. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  169.  
  170. -- Updated 10/14/2014 - Updated to 1.0.2
  171. --- Fixed bug fix.
  172.  
  173. -- Updated 10/14/2014 - Updated to 1.0.3
  174. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  175.  
  176. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  177.  
  178.  
  179. local function CallOnChildren(Instance, FunctionToCall)
  180. -- Calls a function on each of the children of a certain object, using recursion.
  181.  
  182. FunctionToCall(Instance)
  183.  
  184. for _, Child in next, Instance:GetChildren() do
  185. CallOnChildren(Child, FunctionToCall)
  186. end
  187. end
  188.  
  189. local function GetNearestParent(Instance, ClassName)
  190. -- Returns the nearest parent of a certain class, or returns nil
  191.  
  192. local Ancestor = Instance
  193. repeat
  194. Ancestor = Ancestor.Parent
  195. if Ancestor == nil then
  196. return nil
  197. end
  198. until Ancestor:IsA(ClassName)
  199.  
  200. return Ancestor
  201. end
  202.  
  203. local function GetBricks(StartInstance)
  204. local List = {}
  205.  
  206. -- if StartInstance:IsA("BasePart") then
  207. -- List[#List+1] = StartInstance
  208. -- end
  209.  
  210. CallOnChildren(StartInstance, function(Item)
  211. if Item:IsA("BasePart") then
  212. List[#List+1] = Item;
  213. end
  214. end)
  215.  
  216. return List
  217. end
  218.  
  219. local function Modify(Instance, Values)
  220. -- Modifies an Instance by using a table.
  221.  
  222. assert(type(Values) == "table", "Values is not a table");
  223.  
  224. for Index, Value in next, Values do
  225. if type(Index) == "number" then
  226. Value.Parent = Instance
  227. else
  228. Instance[Index] = Value
  229. end
  230. end
  231. return Instance
  232. end
  233.  
  234. local function Make(ClassType, Properties)
  235. -- Using a syntax hack to create a nice way to Make new items.
  236.  
  237. return Modify(Instance.new(ClassType), Properties)
  238. end
  239.  
  240. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  241. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  242.  
  243. local function HasWheelJoint(Part)
  244. for _, SurfaceName in pairs(Surfaces) do
  245. for _, HingSurfaceName in pairs(HingSurfaces) do
  246. if Part[SurfaceName].Name == HingSurfaceName then
  247. return true
  248. end
  249. end
  250. end
  251.  
  252. return false
  253. end
  254.  
  255. local function ShouldBreakJoints(Part)
  256. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  257. -- definitely some edge cases.
  258.  
  259. if NEVER_BREAK_JOINTS then
  260. return false
  261. end
  262.  
  263. if HasWheelJoint(Part) then
  264. return false
  265. end
  266.  
  267. local Connected = Part:GetConnectedParts()
  268.  
  269. if #Connected == 1 then
  270. return false
  271. end
  272.  
  273. for _, Item in pairs(Connected) do
  274. if HasWheelJoint(Item) then
  275. return false
  276. elseif not Item:IsDescendantOf(script.Parent) then
  277. return false
  278. end
  279. end
  280.  
  281. return true
  282. end
  283.  
  284. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  285. --- Weld's 2 parts together
  286. -- @param Part0 The first part
  287. -- @param Part1 The second part (Dependent part most of the time).
  288. -- @param [JointType] The type of joint. Defaults to weld.
  289. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  290. -- @return The weld created.
  291.  
  292. JointType = JointType or "Weld"
  293. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  294.  
  295. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  296. Modify(NewWeld, {
  297. Name = "qCFrameWeldThingy";
  298. Part0 = Part0;
  299. Part1 = Part1;
  300. C0 = CFrame.new();--Part0.CFrame:inverse();
  301. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  302. Parent = Part1;
  303. })
  304.  
  305. if not RelativeValue then
  306. RelativeValue = Make("CFrameValue", {
  307. Parent = Part1;
  308. Name = "qRelativeCFrameWeldValue";
  309. Archivable = true;
  310. Value = NewWeld.C1;
  311. })
  312. end
  313.  
  314. return NewWeld
  315. end
  316.  
  317. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  318. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  319. -- @param MainPart The part to weld the model to (can be in the model).
  320. -- @param [JointType] The type of joint. Defaults to weld.
  321. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  322.  
  323. for _, Part in pairs(Parts) do
  324. if ShouldBreakJoints(Part) then
  325. Part:BreakJoints()
  326. end
  327. end
  328.  
  329. for _, Part in pairs(Parts) do
  330. if Part ~= MainPart then
  331. WeldTogether(MainPart, Part, JointType, MainPart)
  332. end
  333. end
  334.  
  335. if not DoNotUnanchor then
  336. for _, Part in pairs(Parts) do
  337. Part.Anchored = false
  338. end
  339. MainPart.Anchored = false
  340. end
  341. end
  342.  
  343. local function PerfectionWeld()
  344. local Tool = GetNearestParent(script, "Tool")
  345.  
  346. local Parts = GetBricks(script.Parent)
  347. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  348.  
  349. if PrimaryPart then
  350. WeldParts(Parts, PrimaryPart, "Weld", false)
  351. else
  352. warn("qWeld - Unable to weld part")
  353. end
  354.  
  355. return Tool
  356. end
  357.  
  358. local Tool = PerfectionWeld()
  359.  
  360.  
  361. if Tool and script.ClassName == "Script" then
  362. --- Don't bother with local scripts
  363.  
  364. script.Parent.AncestryChanged:connect(function()
  365. PerfectionWeld()
  366. end)
  367. end
  368.  
  369. -- Created by Quenty (@Quenty, follow me on twitter).
  370.  
  371. end))
  372. Script11.Parent = Tool0
  373. table.insert(cors,sandbox(Script11,function()
  374. script.Parent.blade.Touched:connect(function(p)
  375. if script.Parent.CanDamage.Value == true then
  376. script.Parent.CanDamage.Value = false
  377. p.Parent.Humanoid:TakeDamage(200)
  378. end
  379. end)
  380. end))
  381. Script12.Parent = Tool0
  382. table.insert(cors,sandbox(Script12,function()
  383. script.Parent.Equipped:Connect(function()
  384. script.Parent.Handle.Equip:Play()
  385. end)
  386. end))
  387. Script13.Name = "Server"
  388. Script13.Parent = Tool0
  389. table.insert(cors,sandbox(Script13,function()
  390. --//Variables\\--
  391. local tool = script.Parent
  392. local handle = tool:WaitForChild("Handle")
  393. local muzzle = tool:WaitForChild("Muzzle")
  394. local muzzleFlash = muzzle:WaitForChild("MuzzleFlash")
  395. local muzzleEffect = muzzleFlash:WaitForChild("MuzzleEffect")
  396.  
  397. local configs = tool:WaitForChild("Configurations")
  398. local fireRate = configs:FindFirstChild("FireRate")
  399. local maxDamage = configs:FindFirstChild("MaxDamage")
  400. local minDamage = configs:FindFirstChild("MinDamage")
  401. local velocity = configs:FindFirstChild("Velocity")
  402. local accuracy = configs:FindFirstChild("Accuracy")
  403. local specialDuration = configs:FindFirstChild("SpecialDuration")
  404. local specialRechargeTime = configs:FindFirstChild("SpecialRechargeTime")
  405.  
  406. local showDamageText = true
  407.  
  408. local debris = game:GetService("Debris")
  409.  
  410. local fire = tool:WaitForChild("Fire")
  411. local activateSpecial = tool:WaitForChild("ActivateSpecial")
  412. local hit = tool:WaitForChild("Hit")
  413.  
  414. --//Custom Functions\\--
  415. function TagHumanoid(humanoid, player)
  416. local Creator_Tag = Instance.new("ObjectValue")
  417. Creator_Tag.Name = "creator"
  418. Creator_Tag.Value = player
  419. debris:AddItem(Creator_Tag, 0.3)
  420. Creator_Tag.Parent = humanoid
  421. end
  422.  
  423. function UntagHumanoid(humanoid)
  424. for i, v in pairs(humanoid:GetChildren()) do
  425. if v:IsA("ObjectValue") and v.Name == "creator" then
  426. v:Destroy()
  427. end
  428. end
  429. end
  430.  
  431. function TextEffects(element, floatAmount, direction, style, duration)
  432. element:TweenPosition(UDim2.new(0, math.random(-40, 40), 0, -floatAmount), direction, style, duration)
  433. wait(0.5)
  434.  
  435. for i = 1, 60 do
  436. element.TextTransparency = element.TextTransparency + 1/60
  437. element.TextStrokeTransparency = element.TextStrokeTransparency + 1/60
  438. wait(1/60)
  439. end
  440.  
  441. element.TextTransparency = element.TextTransparency + 1
  442. element.TextStrokeTransparency = element.TextStrokeTransparency + 1
  443. element.Parent:Destroy()
  444. end
  445.  
  446. function DynamicText(damage, criticalPoint, humanoid)
  447. local bill = Instance.new("BillboardGui", humanoid.Parent.Head)
  448. bill.Size = UDim2.new(0, 50, 0, 100)
  449. local part = Instance.new("TextLabel", bill)
  450. bill.AlwaysOnTop = true
  451. part.TextColor3 = Color3.fromRGB(255, 0, 0)
  452. part.Text = damage
  453. part.Font = Enum.Font.SourceSans
  454. part.TextStrokeTransparency = 0
  455. part.Size = UDim2.new(1, 0, 1, 0)
  456. part.Position = UDim2.new(0, 0, 0, 0)
  457. part.BackgroundTransparency = 1
  458. bill.Adornee = bill.Parent
  459.  
  460. if damage < criticalPoint then
  461. part.TextSize = 28
  462. part.TextColor3 = Color3.new(1, 0, 0)
  463. elseif damage >= criticalPoint then
  464. part.TextSize = 32
  465. part.TextColor3 = Color3.new(1, 1, 0)
  466. end
  467.  
  468. spawn(function()
  469. TextEffects(part, 85, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.75)
  470. end)
  471. end
  472.  
  473. function DamageAndTagHumanoid(player, humanoid, damage)
  474. hit:FireClient(player)
  475. UntagHumanoid(handle)
  476. humanoid:TakeDamage(damage) TagHumanoid(humanoid, player)
  477. end
  478.  
  479. --//Remote Functions\\--
  480. fire.OnServerEvent:Connect(function(player, mouseHit)
  481. local character = player.Character
  482. local humanoid = character:FindFirstChild("Humanoid")
  483. local weaponAccuracy = Vector3.new(math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2))
  484.  
  485. if humanoid and humanoid ~= 0 then
  486. local projectile = Instance.new("Part", workspace)
  487.  
  488. local trail = Instance.new("Trail", projectile)
  489. trail.FaceCamera = true
  490. trail.Lifetime = 0.3
  491. trail.MinLength = 0.15
  492. trail.LightEmission = 0.25
  493.  
  494. local attachment0 = Instance.new("Attachment", projectile)
  495. attachment0.Position = Vector3.new(0.35, 0, 0)
  496. attachment0.Name = "Attachment1"
  497. local attachment1 = Instance.new("Attachment", projectile)
  498. attachment1.Position = Vector3.new(-0.35, 0, 0)
  499. attachment1.Name = "Attachment1"
  500.  
  501. trail.Attachment0 = attachment0
  502. trail.Attachment1 = attachment1
  503.  
  504. projectile.Name = "Bullet"
  505. projectile.BrickColor = BrickColor.new("Smoky gray")
  506. projectile.Shape = "Ball"
  507. projectile.Material = Enum.Material.Metal
  508. projectile.TopSurface = 0
  509. projectile.BottomSurface = 0
  510. projectile.Size = Vector3.new(1, 1, 1)
  511. projectile.Transparency = 1
  512. projectile.CFrame = CFrame.new(muzzle.CFrame.p, mouseHit.p)
  513. projectile.CanCollide = false
  514.  
  515. local transparencyPoints = {}
  516. local startColor = Color3.new(255, 255, 0)
  517. local endColor = Color3.new(213, 115, 61)
  518.  
  519. table.insert(transparencyPoints, NumberSequenceKeypoint.new(0, 1))
  520. table.insert(transparencyPoints, NumberSequenceKeypoint.new(0.25, 0))
  521. table.insert(transparencyPoints, NumberSequenceKeypoint.new(1, 1))
  522.  
  523. local determinedTransparency = NumberSequence.new(transparencyPoints)
  524. local determinedColors = ColorSequence.new(startColor, endColor)
  525.  
  526. trail.Transparency = determinedTransparency
  527. trail.Color = determinedColors
  528.  
  529. local bodyVelocity = Instance.new("BodyVelocity", projectile)
  530. bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
  531. bodyVelocity.Velocity = (mouseHit.lookVector * velocity.Value) + weaponAccuracy
  532.  
  533. debris:AddItem(projectile, 20)
  534.  
  535. projectile.Touched:Connect(function(hit)
  536. local eHumanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
  537. local damage = math.random(minDamage.Value, maxDamage.Value)
  538. if not eHumanoid and not hit.Anchored and not hit:IsDescendantOf(character) then
  539.  
  540. projectile:Destroy()
  541. elseif eHumanoid and eHumanoid ~= humanoid and eHumanoid.Health > 0 and hit ~= projectile then
  542.  
  543. if hit.Name == "Head" or hit:IsA("Hat") then
  544. damage = damage * 1.5
  545. end
  546.  
  547. local criticalPoint = maxDamage.Value
  548. DamageAndTagHumanoid(player, eHumanoid, damage)
  549.  
  550. if showDamageText then
  551. DynamicText(damage, criticalPoint, eHumanoid)
  552. else
  553. end
  554.  
  555. projectile:Destroy()
  556. elseif hit.CanCollide == true and not hit:IsDescendantOf(player.Character) and hit.Anchored == true then
  557.  
  558. projectile:Destroy()
  559. end
  560. end)
  561.  
  562. handle.Fire:Play()
  563. muzzleEffect.Visible = true
  564. muzzleEffect.Rotation = math.random(-360, 360)
  565.  
  566. delay(0.1, function()
  567. muzzleEffect.Visible = false
  568. end)
  569.  
  570. end
  571. end)
  572.  
  573. activateSpecial.OnServerEvent:Connect(function(player)
  574. accuracy.Value, fireRate.Value = accuracy.Value / 2, fireRate.Value / 2
  575. minDamage.Value, maxDamage.Value = minDamage.Value / 2, maxDamage.Value / 2
  576.  
  577. spawn(function()
  578. local chargeSound = Instance.new("Sound", player.PlayerGui)
  579. chargeSound.Name = "ChargeSound"
  580. chargeSound.SoundId = "rbxassetid://163619849"
  581. chargeSound:Play()
  582.  
  583. chargeSound.Ended:Connect(function() chargeSound:Destroy() end)
  584.  
  585. local sparkles = Instance.new("Sparkles", handle)
  586. sparkles.SparkleColor = Color3.fromRGB(255, 236, 21)
  587.  
  588. local activatedGui = Instance.new("ScreenGui", player.PlayerGui)
  589. activatedGui.Name = "SpecialActivated"
  590. local textLabel = Instance.new("TextLabel", activatedGui)
  591. textLabel.TextColor3 = Color3.fromRGB(0, 180, 30)
  592. textLabel.Text = "Overkill/BeastMode Activated!"
  593. textLabel.Font = Enum.Font.SourceSans
  594. textLabel.TextScaled = true
  595. textLabel.TextStrokeTransparency = 0
  596. textLabel.Size = UDim2.new(0, 300, 0, 50)
  597. textLabel.Position = UDim2.new(2.5, 0, 0.15, -10)
  598. textLabel.BackgroundTransparency = 1
  599. textLabel:TweenPosition(UDim2.new(0.5, -(textLabel.Size.X.Offset / 2), 0.1, -10), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1)
  600.  
  601. debris:AddItem(sparkles, specialDuration.Value)
  602. debris:AddItem(chargeSound, 3)
  603.  
  604. wait(3)
  605. TextEffects(textLabel, 200, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
  606. end)
  607.  
  608. for i = specialDuration.Value, 0, -1 do
  609. wait(1)
  610. print("Special activated: "..i)
  611. end
  612.  
  613. accuracy.Value, fireRate.Value = accuracy.Value * 2, fireRate.Value * 2
  614. minDamage.Value, maxDamage.Value = minDamage.Value * 2, maxDamage.Value * 2
  615. activateSpecial:FireClient(player)
  616. end)
  617. end))
  618. LocalScript14.Name = "BackupWeld"
  619. LocalScript14.Parent = Tool0
  620. table.insert(cors,sandbox(LocalScript14,function()
  621. function Weld(x,y)
  622. local W = Instance.new("Weld")
  623. W.Part0 = x
  624. W.Part1 = y
  625. local CJ = CFrame.new(x.Position)
  626. local C0 = x.CFrame:inverse()*CJ
  627. local C1 = y.CFrame:inverse()*CJ
  628. W.C0 = C0
  629. W.C1 = C1
  630. W.Parent = x
  631. end
  632.  
  633. function Get(A)
  634. if A.className == "Part" then
  635. Weld(script.Parent.Handle, A)
  636. A.Anchored = false
  637. else
  638. local C = A:GetChildren()
  639. for i=1, #C do
  640. Get(C[i])
  641. end
  642. end
  643. end
  644.  
  645. function Finale()
  646. Get(script.Parent)
  647. end
  648.  
  649. script.Parent.Equipped:connect(Finale)
  650. script.Parent.Unequipped:connect(Finale)
  651. Finale()
  652. end))
  653. LocalScript15.Name = "Client"
  654. LocalScript15.Parent = Tool0
  655. table.insert(cors,sandbox(LocalScript15,function()
  656. --//Variables\\--
  657. local tool = script.Parent
  658. local handle = tool:WaitForChild("Handle")
  659.  
  660. local contextActionService = game:GetService("ContextActionService")
  661.  
  662. local player = game.Players.LocalPlayer
  663. local mouse = player:GetMouse()
  664. local character = player.Character or player.CharacterAdded:Wait()
  665.  
  666. local enabled = true
  667. local specialDB = true
  668.  
  669. local cursorId = "http://www.roblox.com/asset/?id=251497633"
  670. local hitId = "http://www.roblox.com/asset/?id=70785856"
  671.  
  672. local configs = tool:WaitForChild("Configurations")
  673. local fireRate = configs:FindFirstChild("FireRate")
  674. local specialRechargeTime = configs:FindFirstChild("SpecialRechargeTime")
  675.  
  676. local fire = tool:WaitForChild("Fire")
  677. local activateSpecial = tool:WaitForChild("ActivateSpecial")
  678. local hit = tool:WaitForChild("Hit")
  679.  
  680. --//Custom Functions\\--
  681. function activate()
  682. if specialDB then
  683. specialDB = false
  684. activateSpecial:FireServer()
  685. else
  686. end
  687. end
  688.  
  689. --//Tool Function\\--
  690. tool.Equipped:Connect(function()
  691. contextActionService:BindAction("ActivateSpecial", activate, true, Enum.KeyCode.E)
  692. contextActionService:SetImage("ActivateSpecial", tool.TextureId)
  693. contextActionService:SetPosition("ActivateSpecial", UDim2.new(0.72, -25, 0.20, -25))
  694. mouse.Icon = cursorId
  695. end)
  696.  
  697. tool.Unequipped:Connect(function()
  698. contextActionService:UnbindAction("ActivateSpecial")
  699. mouse.Icon = ""
  700. end)
  701.  
  702. tool.Activated:Connect(function()
  703. if not enabled then return end
  704.  
  705. enabled = false
  706. fire:FireServer(mouse.Hit)
  707. wait(fireRate.Value)
  708. enabled = true
  709. end)
  710.  
  711. hit.OnClientEvent:Connect(function()
  712. mouse.Icon = hitId
  713. handle.Hitmark:Play()
  714. wait(0.075)
  715. mouse.Icon = cursorId
  716. end)
  717.  
  718. activateSpecial.OnClientEvent:Connect(function()
  719.  
  720. for i = specialRechargeTime.Value, 0, -1 do
  721. wait(1)
  722. specialDB = false
  723. print("Recharging: "..i)
  724. end
  725.  
  726. specialDB = true
  727. end)
  728. end))
  729. RemoteEvent16.Name = "ActivateSpecial"
  730. RemoteEvent16.Parent = Tool0
  731. RemoteEvent17.Name = "Fire"
  732. RemoteEvent17.Parent = Tool0
  733. RemoteEvent18.Name = "Hit"
  734. RemoteEvent18.Parent = Tool0
  735. Part19.Name = "Muzzle"
  736. Part19.Parent = Tool0
  737. Part19.CFrame = CFrame.new(7.95016527, 1.4021982, -0.40956521, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  738. Part19.Position = Vector3.new(7.95016527, 1.4021982, -0.40956521)
  739. Part19.Transparency = 1
  740. Part19.Size = Vector3.new(0.0650132671, 0.0650132671, 0.0650132671)
  741. Part19.Anchored = true
  742. Part19.BottomSurface = Enum.SurfaceType.Smooth
  743. Part19.TopSurface = Enum.SurfaceType.Smooth
  744. Script20.Name = "qPerfectionWeld"
  745. Script20.Parent = Part19
  746. table.insert(cors,sandbox(Script20,function()
  747. -- Created by Quenty (@Quenty, follow me on twitter).
  748. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  749. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  750.  
  751. --[[ INSTRUCTIONS
  752. - Place in the model
  753. - Make sure model is anchored
  754. - That's it. It will weld the model and all children.
  755.  
  756. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  757. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  758. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  759. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  760. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  761. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  762. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  763. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  764.  
  765. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  766. ]]
  767.  
  768. --[[ DOCUMENTATION
  769. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  770. - Will work in PBS servers
  771. - Will work as long as it starts out with the part anchored
  772. - Stores the relative CFrame as a CFrame value
  773. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  774. - Utilizes a recursive algorith to find all parts in the model
  775. - Will reweld on script reparent if the script is initially parented to a tool.
  776. - Welds as fast as possible
  777. ]]
  778.  
  779. -- qPerfectionWeld.lua
  780. -- Created 10/6/2014
  781. -- Author: Quenty
  782. -- Version 1.0.3
  783.  
  784. -- Updated 10/14/2014 - Updated to 1.0.1
  785. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  786.  
  787. -- Updated 10/14/2014 - Updated to 1.0.2
  788. --- Fixed bug fix.
  789.  
  790. -- Updated 10/14/2014 - Updated to 1.0.3
  791. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  792.  
  793. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  794.  
  795.  
  796. local function CallOnChildren(Instance, FunctionToCall)
  797. -- Calls a function on each of the children of a certain object, using recursion.
  798.  
  799. FunctionToCall(Instance)
  800.  
  801. for _, Child in next, Instance:GetChildren() do
  802. CallOnChildren(Child, FunctionToCall)
  803. end
  804. end
  805.  
  806. local function GetNearestParent(Instance, ClassName)
  807. -- Returns the nearest parent of a certain class, or returns nil
  808.  
  809. local Ancestor = Instance
  810. repeat
  811. Ancestor = Ancestor.Parent
  812. if Ancestor == nil then
  813. return nil
  814. end
  815. until Ancestor:IsA(ClassName)
  816.  
  817. return Ancestor
  818. end
  819.  
  820. local function GetBricks(StartInstance)
  821. local List = {}
  822.  
  823. -- if StartInstance:IsA("BasePart") then
  824. -- List[#List+1] = StartInstance
  825. -- end
  826.  
  827. CallOnChildren(StartInstance, function(Item)
  828. if Item:IsA("BasePart") then
  829. List[#List+1] = Item;
  830. end
  831. end)
  832.  
  833. return List
  834. end
  835.  
  836. local function Modify(Instance, Values)
  837. -- Modifies an Instance by using a table.
  838.  
  839. assert(type(Values) == "table", "Values is not a table");
  840.  
  841. for Index, Value in next, Values do
  842. if type(Index) == "number" then
  843. Value.Parent = Instance
  844. else
  845. Instance[Index] = Value
  846. end
  847. end
  848. return Instance
  849. end
  850.  
  851. local function Make(ClassType, Properties)
  852. -- Using a syntax hack to create a nice way to Make new items.
  853.  
  854. return Modify(Instance.new(ClassType), Properties)
  855. end
  856.  
  857. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  858. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  859.  
  860. local function HasWheelJoint(Part)
  861. for _, SurfaceName in pairs(Surfaces) do
  862. for _, HingSurfaceName in pairs(HingSurfaces) do
  863. if Part[SurfaceName].Name == HingSurfaceName then
  864. return true
  865. end
  866. end
  867. end
  868.  
  869. return false
  870. end
  871.  
  872. local function ShouldBreakJoints(Part)
  873. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  874. -- definitely some edge cases.
  875.  
  876. if NEVER_BREAK_JOINTS then
  877. return false
  878. end
  879.  
  880. if HasWheelJoint(Part) then
  881. return false
  882. end
  883.  
  884. local Connected = Part:GetConnectedParts()
  885.  
  886. if #Connected == 1 then
  887. return false
  888. end
  889.  
  890. for _, Item in pairs(Connected) do
  891. if HasWheelJoint(Item) then
  892. return false
  893. elseif not Item:IsDescendantOf(script.Parent) then
  894. return false
  895. end
  896. end
  897.  
  898. return true
  899. end
  900.  
  901. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  902. --- Weld's 2 parts together
  903. -- @param Part0 The first part
  904. -- @param Part1 The second part (Dependent part most of the time).
  905. -- @param [JointType] The type of joint. Defaults to weld.
  906. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  907. -- @return The weld created.
  908.  
  909. JointType = JointType or "Weld"
  910. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  911.  
  912. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  913. Modify(NewWeld, {
  914. Name = "qCFrameWeldThingy";
  915. Part0 = Part0;
  916. Part1 = Part1;
  917. C0 = CFrame.new();--Part0.CFrame:inverse();
  918. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  919. Parent = Part1;
  920. })
  921.  
  922. if not RelativeValue then
  923. RelativeValue = Make("CFrameValue", {
  924. Parent = Part1;
  925. Name = "qRelativeCFrameWeldValue";
  926. Archivable = true;
  927. Value = NewWeld.C1;
  928. })
  929. end
  930.  
  931. return NewWeld
  932. end
  933.  
  934. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  935. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  936. -- @param MainPart The part to weld the model to (can be in the model).
  937. -- @param [JointType] The type of joint. Defaults to weld.
  938. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  939.  
  940. for _, Part in pairs(Parts) do
  941. if ShouldBreakJoints(Part) then
  942. Part:BreakJoints()
  943. end
  944. end
  945.  
  946. for _, Part in pairs(Parts) do
  947. if Part ~= MainPart then
  948. WeldTogether(MainPart, Part, JointType, MainPart)
  949. end
  950. end
  951.  
  952. if not DoNotUnanchor then
  953. for _, Part in pairs(Parts) do
  954. Part.Anchored = false
  955. end
  956. MainPart.Anchored = false
  957. end
  958. end
  959.  
  960. local function PerfectionWeld()
  961. local Tool = GetNearestParent(script, "Tool")
  962.  
  963. local Parts = GetBricks(script.Parent)
  964. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  965.  
  966. if PrimaryPart then
  967. WeldParts(Parts, PrimaryPart, "Weld", false)
  968. else
  969. warn("qWeld - Unable to weld part")
  970. end
  971.  
  972. return Tool
  973. end
  974.  
  975. local Tool = PerfectionWeld()
  976.  
  977.  
  978. if Tool and script.ClassName == "Script" then
  979. --- Don't bother with local scripts
  980.  
  981. script.Parent.AncestryChanged:connect(function()
  982. PerfectionWeld()
  983. end)
  984. end
  985.  
  986. -- Created by Quenty (@Quenty, follow me on twitter).
  987.  
  988. end))
  989. BillboardGui21.Name = "MuzzleFlash"
  990. BillboardGui21.Parent = Part19
  991. BillboardGui21.Size = UDim2.new(0, 150, 0, 150)
  992. BillboardGui21.Active = true
  993. BillboardGui21.MaxDistance = 150
  994. ImageLabel22.Name = "MuzzleEffect"
  995. ImageLabel22.Parent = BillboardGui21
  996. ImageLabel22.Visible = false
  997. ImageLabel22.Size = UDim2.new(1, 0, 1, 0)
  998. ImageLabel22.BackgroundColor = BrickColor.new("Institutional white")
  999. ImageLabel22.BackgroundColor3 = Color3.new(1, 1, 1)
  1000. ImageLabel22.BackgroundTransparency = 1
  1001. ImageLabel22.Image = "rbxassetid://192664810"
  1002. ImageLabel22.ImageTransparency = 1
  1003. Configuration23.Name = "Configurations"
  1004. Configuration23.Parent = Tool0
  1005. NumberValue24.Name = "FireRate"
  1006. NumberValue24.Parent = Configuration23
  1007. NumberValue25.Name = "MinDamage"
  1008. NumberValue25.Parent = Configuration23
  1009. NumberValue25.Value = 40
  1010. NumberValue26.Name = "MaxDamage"
  1011. NumberValue26.Parent = Configuration23
  1012. NumberValue26.Value = 45
  1013. NumberValue27.Name = "Velocity"
  1014. NumberValue27.Parent = Configuration23
  1015. NumberValue27.Value = 625
  1016. NumberValue28.Name = "Accuracy"
  1017. NumberValue28.Parent = Configuration23
  1018. NumberValue28.Value = 5
  1019. NumberValue29.Name = "SpecialDuration"
  1020. NumberValue29.Parent = Configuration23
  1021. NumberValue29.Value = 35
  1022. NumberValue30.Name = "SpecialRechargeTime"
  1023. NumberValue30.Parent = Configuration23
  1024. NumberValue30.Value = 60
  1025. for i,v in pairs(mas:GetChildren()) do
  1026. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1027. pcall(function() v:MakeJoints() end)
  1028. end
  1029. mas:Destroy()
  1030. for i,v in pairs(cors) do
  1031. spawn(function()
  1032. pcall(v)
  1033. end)
  1034. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement