Advertisement
alpayspastbin

Untitled

May 26th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.47 KB | None | 0 0
  1. Player = game.Players:FindFirstChild("alpay2006")
  2. Name = "kkk"
  3. selected = false
  4. dropped = false
  5. Button1Down = false
  6. damage = 45
  7. canFire = true
  8. canFire2 = false
  9. readyTime = 0.1
  10. reloadTime = 1.2
  11. automatic = false
  12. burst = false
  13. burstCount = 0
  14. burstCountMax = 3
  15.  
  16.  
  17. ammoGui = Instance.new("ScreenGui")
  18. ammoGui.Name = Name
  19. frame = Instance.new("Frame")
  20. frame.Name = "Frame"
  21. frame.Size = UDim2.new(0, 165, 0, 60)
  22. frame.Position = UDim2.new(0, 0, 1, -60)
  23. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  24. frame.BorderColor3 = Color3.new(0, 0, 0)
  25. frame.Parent = ammoGui
  26. label = Instance.new("TextLabel")
  27. label.Name = "Weapon"
  28. label.Text = "Weapon: " ..Name
  29. label.Size = UDim2.new(1, 0, 0, 20)
  30. label.Position = UDim2.new(0, 0, 0, 0)
  31. label.BackgroundColor3 = Color3.new(1, 0, 0)
  32. label.BorderColor3 = Color3.new(0, 0, 0)
  33. label.Parent = frame
  34. label = Instance.new("TextLabel")
  35. label.Name = "MagazinePrefix"
  36. label.Text = " Magazine:"
  37. label.TextXAlignment = "Left"
  38. label.Size = UDim2.new(1, 0, 0, 20)
  39. label.Position = UDim2.new(0, 0, 0, 20)
  40. label.BackgroundColor3 = Color3.new(1, 1, 1)
  41. label.BorderColor3 = Color3.new(0, 0, 0)
  42. label.Parent = frame
  43. label = Instance.new("TextLabel")
  44. label.Name = "Magazine"
  45. label.Text = "0/0"
  46. label.TextXAlignment = "Right"
  47. label.Size = UDim2.new(1, 0, 0, 20)
  48. label.Position = UDim2.new(0, -10, 0, 20)
  49. label.BackgroundTransparency = 1
  50. label.BorderSizePixel = 0
  51. label.Parent = frame
  52. label = Instance.new("TextLabel")
  53. label.Name = "AmmoPrefix"
  54. label.Text = " Ammunition:"
  55. label.TextXAlignment = "Left"
  56. label.Size = UDim2.new(1, 0, 0, 20)
  57. label.Position = UDim2.new(0, 0, 0, 40)
  58. label.BackgroundColor3 = Color3.new(1, 1, 1)
  59. label.BorderColor3 = Color3.new(0, 0, 0)
  60. label.Parent = frame
  61. label = Instance.new("TextLabel")
  62. label.Name = "Ammo"
  63. label.Text = "0/0"
  64. label.TextXAlignment = "Right"
  65. label.Size = UDim2.new(1, 0, 0, 20)
  66. label.Position = UDim2.new(0, -10, 0, 40)
  67. label.BackgroundTransparency = 1
  68. label.BorderSizePixel = 0
  69. label.Parent = frame
  70.  
  71.  
  72. function GetPhysicsChildren(path)
  73. local objects = {}
  74. for _, children in pairs(path:GetChildren()) do
  75. if children.className == "Part" or children.className == "Seat" or children.className == "WedgePart" or children.className == "TrussPart" or children.className == "VehicleSeat" or children.className == "SkateboardPlatform" then
  76. table.insert(objects, children)
  77. end
  78. if #children:GetChildren() > 0 then
  79. local objects2 = GetPhysicsChildren(children)
  80. for i = 1, #objects2 do
  81. table.insert(objects, objects2[i])
  82. end
  83. end
  84. end
  85. return objects
  86. end
  87.  
  88.  
  89. function RayCast(pos1, pos2, maxDistance)
  90. local pos0 = pos1
  91. local objects = GetPhysicsChildren(game:GetService("Workspace"))
  92. for distance = 1, maxDistance, 1 do
  93. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -distance)).p
  94. for _, children in pairs(objects) do
  95. if children.Parent ~= Player.Character:FindFirstChild(Name) and children.Name ~= "Bullet Trail" then
  96. --if (children.CanCollide and children.Transparency > 0) or (game:GetService("Players"):getPlayerFromCharacter(children.Parent)) then
  97. local pos3 = children.CFrame:pointToObjectSpace(pos0)
  98. if pos3.x > -(children.Size.x / 2) and pos3.x < (children.Size.x / 2) and pos3.y > -(children.Size.y / 2) and pos3.y < (children.Size.y / 2) and pos3.z > -(children.Size.z / 2) and pos3.z < (children.Size.z / 2) then
  99. return pos0, children
  100. end
  101. end
  102. end
  103. end
  104. return pos0, nil
  105. end
  106.  
  107.  
  108. function updateGui(type)
  109. if selected == false then return end
  110. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  111. if Player.PlayerGui:FindFirstChild(Name) == nil then
  112. ammoGui:Clone().Parent = Player.PlayerGui
  113. end
  114. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  115. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  116. end
  117.  
  118.  
  119. function makeParts(format)
  120. model = Instance.new("Model")
  121. model.Name = Name
  122. model.Parent = Player.Character
  123. local pm = Instance.new("Part")
  124. pm.Name = "Handle"
  125. pm.formFactor = "Symmetric"
  126. pm.Size = Vector3.new(1, 1, 1)
  127. pm.BrickColor = BrickColor.new("Really black")
  128. pm.Locked = true
  129. pm.TopSurface = 0
  130. pm.BottomSurface = 0
  131. pm.Parent = model
  132. local m = Instance.new("SpecialMesh")
  133. m.MeshType = "Brick"
  134. m.Scale = Vector3.new(0.3, 0.9, 0.4)
  135. m.Parent = pm
  136. if format ~= nil then
  137. local w = Instance.new("Weld")
  138. w.Part0 = pm
  139. if format == "hand" then
  140. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  141. w.C0 = CFrame.new(0, 1.2, 0.7)
  142. w.C1 = CFrame.new()
  143. w.Parent = pm
  144. elseif format == "holster" then
  145. w.Part1 = Player.Character:FindFirstChild("Right Leg")
  146. w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  147. w.C1 = CFrame.new()
  148. w.Parent = pm
  149. model.Name = Name.. " (Holstered)"
  150. else
  151. print("Error: Incorrect format string!")
  152. end
  153. end
  154. --[[
  155. sniper1 http://www.roblox.com/asset/?id=1868836
  156. equip http://www.roblox.com/asset/?id=13510737
  157. fire1 http://www.roblox.com/asset/?id=2760979
  158. fire2 http://www.roblox.com/asset/?id=13510352
  159. fire3 http://www.roblox.com/asset/?id=2692806
  160. fire4 http://www.roblox.com/asset/?id=2691586
  161. fire5 http://www.roblox.com/asset/?id=2920959
  162. fire6 http://www.roblox.com/asset/?id=2697431
  163. fire7 http://www.roblox.com/asset/?id=2920959
  164. reload1 http://www.roblox.com/asset/?id=2691591
  165. reload2 http://www.roblox.com/asset/?id=2697432
  166. reload3 http://www.roblox.com/asset/?id=2920960
  167. reload4 http://www.roblox.com/asset/?id=2761842
  168. shotgun1 http://www.roblox.com/asset/?id=2697294
  169. --]]
  170. local s = Instance.new("Sound")
  171. s.Name = "Fire"
  172. s.SoundId = "http://www.roblox.com/asset/?id=2920959"
  173. s.Volume = 1
  174. s.Pitch = 1
  175. s.Looped = false
  176. s.Parent = pm
  177. local s = Instance.new("Sound")
  178. s.Name = "Reload"
  179. s.SoundId = "http://www.roblox.com/asset/?version=1&id=2691591"
  180. s.Volume = 1
  181. s.Pitch = 3
  182. s.Looped = false
  183. s.Parent = pm
  184. local s = Instance.new("Sound")
  185. s.Name = "Empty"
  186. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  187. s.Volume = 1
  188. s.Pitch = 5
  189. s.Looped = false
  190. s.Parent = pm
  191. local p = Instance.new("Part")
  192. p.Name = "ShellOut"
  193. p.formFactor = "Symmetric"
  194. p.Size = Vector3.new(1, 1, 1)
  195. p.Transparency = 1
  196. p.Locked = true
  197. p.CanCollide = false
  198. p.TopSurface = 0
  199. p.BottomSurface = 0
  200. p.Parent = model
  201. local w = Instance.new("Weld")
  202. w.Part0 = p
  203. w.Part1 = pm
  204. w.C0 = CFrame.new(0.5, 0, 0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
  205. w.C1 = CFrame.new()
  206. w.Parent = p
  207. local p = Instance.new("Part")
  208. p.Name = "Grip"
  209. p.formFactor = "Symmetric"
  210. p.Size = Vector3.new(1, 1, 1)
  211. p.BrickColor = BrickColor.new("Really black")
  212. p.Locked = true
  213. p.TopSurface = 0
  214. p.BottomSurface = 0
  215. p.Parent = model
  216. local m = Instance.new("SpecialMesh")
  217. m.MeshType = "Brick"
  218. m.Scale = Vector3.new(0.3, 0.5, 0.9)
  219. m.Parent = p
  220. local w = Instance.new("Weld")
  221. w.Part0 = p
  222. w.Part1 = pm
  223. w.C0 = CFrame.new(0, -0.05, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  224. w.C1 = CFrame.new()
  225. w.Parent = p
  226. local p = Instance.new("Part")
  227. p.Name = "Magazine"
  228. p.formFactor = "Symmetric"
  229. p.Size = Vector3.new(1, 1, 1)
  230. p.BrickColor = BrickColor.new("Really black")
  231. p.Locked = true
  232. p.TopSurface = 0
  233. p.BottomSurface = 0
  234. p.Parent = model
  235. local m = Instance.new("SpecialMesh")
  236. m.MeshType = "Brick"
  237. m.Scale = Vector3.new(0.275, 0.475, 1)
  238. m.Parent = p
  239. local w = Instance.new("Weld")
  240. w.Part0 = p
  241. w.Part1 = pm
  242. w.C0 = CFrame.new(0, -0.05, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  243. w.C1 = CFrame.new()
  244. w.Parent = p
  245. local p = Instance.new("Part")
  246. p.Name = "Trigger Housing"
  247. p.formFactor = "Symmetric"
  248. p.Size = Vector3.new(1, 1, 1)
  249. p.BrickColor = BrickColor.new("Really black")
  250. p.Locked = true
  251. p.TopSurface = 0
  252. p.BottomSurface = 0
  253. p.Parent = model
  254. local m = Instance.new("SpecialMesh")
  255. m.MeshType = "Brick"
  256. m.Scale = Vector3.new(0.1, 0.2, 0.025)
  257. m.Parent = p
  258. local w = Instance.new("Weld")
  259. w.Part0 = p
  260. w.Part1 = pm
  261. w.C0 = CFrame.new(0, 0.2, -0.4)
  262. w.C1 = CFrame.new()
  263. w.Parent = p
  264. local p = Instance.new("Part")
  265. p.Name = "Trigger Housing"
  266. p.formFactor = "Symmetric"
  267. p.Size = Vector3.new(1, 1, 1)
  268. p.BrickColor = BrickColor.new("Really black")
  269. p.Locked = true
  270. p.TopSurface = 0
  271. p.BottomSurface = 0
  272. p.Parent = model
  273. local m = Instance.new("SpecialMesh")
  274. m.MeshType = "Brick"
  275. m.Scale = Vector3.new(0.1, 0.2, 0.025)
  276. m.Parent = p
  277. local w = Instance.new("Weld")
  278. w.Part0 = p
  279. w.Part1 = pm
  280. w.C0 = CFrame.new(0, 0.02, -0.49) * CFrame.fromEulerAnglesXYZ(math.rad(-45), 0, 0)
  281. w.C1 = CFrame.new()
  282. w.Parent = p
  283. local p = Instance.new("Part")
  284. p.Name = "Trigger Housing"
  285. p.formFactor = "Symmetric"
  286. p.Size = Vector3.new(1, 1, 1)
  287. p.BrickColor = BrickColor.new("Really black")
  288. p.Locked = true
  289. p.TopSurface = 0
  290. p.BottomSurface = 0
  291. p.Parent = model
  292. local m = Instance.new("SpecialMesh")
  293. m.MeshType = "Brick"
  294. m.Scale = Vector3.new(0.1, 0.025, 0.1)
  295. m.Parent = p
  296. local w = Instance.new("Weld")
  297. w.Part0 = p
  298. w.Part1 = pm
  299. w.C0 = CFrame.new(0, 0.426, -0.22)
  300. w.C1 = CFrame.new()
  301. w.Parent = p
  302. local p = Instance.new("Part")
  303. p.Name = "Trigger"
  304. p.formFactor = "Symmetric"
  305. p.Size = Vector3.new(1, 1, 1)
  306. p.BrickColor = BrickColor.new("Really black")
  307. p.Locked = true
  308. p.TopSurface = 0
  309. p.BottomSurface = 0
  310. p.Parent = model
  311. local m = Instance.new("SpecialMesh")
  312. m.MeshType = "Brick"
  313. m.Scale = Vector3.new(0.1, 0.025, 0.15)
  314. m.Parent = p
  315. local w = Instance.new("Weld")
  316. w.Part0 = p
  317. w.Part1 = pm
  318. w.C0 = CFrame.new(0, 0.175, -0.3) * CFrame.fromEulerAnglesXYZ(math.rad(-10), 0, 0)
  319. w.C1 = CFrame.new()
  320. w.Parent = p
  321. local p = Instance.new("Part")
  322. p.Name = "Barrel"
  323. p.CanCollide = false
  324. p.formFactor = "Symmetric"
  325. p.Size = Vector3.new(1, 1, 1)
  326. p.BrickColor = BrickColor.new("Really black")
  327. p.Locked = true
  328. p.TopSurface = 0
  329. p.BottomSurface = 0
  330. p.Parent = model
  331. local m = Instance.new("SpecialMesh")
  332. m.MeshType = "Brick"
  333. m.Scale = Vector3.new(0.2, 0.5, 0.35)
  334. m.Parent = p
  335. local w = Instance.new("Weld")
  336. w.Part0 = p
  337. w.Part1 = pm
  338. w.C0 = CFrame.new(0, 0.7, 0.025)
  339. w.C1 = CFrame.new()
  340. w.Parent = p
  341. local p = Instance.new("Part")
  342. p.Name = "Muzzle"
  343. p.formFactor = "Symmetric"
  344. p.Size = Vector3.new(1, 1, 1)
  345. p.BrickColor = BrickColor.new("Really black")
  346. p.CanCollide = false
  347. p.Locked = true
  348. p.TopSurface = 0
  349. p.BottomSurface = 0
  350. p.Parent = model
  351. local m = Instance.new("CylinderMesh")
  352. m.Scale = Vector3.new(0.2, 0.05, 0.2)
  353. m.Parent = p
  354. local w = Instance.new("Weld")
  355. w.Part0 = p
  356. w.Part1 = pm
  357. w.C0 = CFrame.new(0, 0.95, 0.075)
  358. w.C1 = CFrame.new()
  359. w.Parent = p
  360. s = Instance.new("Smoke")
  361. s.Enabled = false
  362. s.Name = "Smoke"
  363. s.RiseVelocity = -5
  364. s.Opacity = 0.3
  365. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  366. s.Size = 1
  367. s.Parent = p
  368. f = Instance.new("Fire")
  369. f.Enabled = false
  370. f.Name = "Fire"
  371. f.Heat = -35
  372. f.Size = 1
  373. f.Parent = p
  374. local p = Instance.new("Part")
  375. p.Name = "Silencer"
  376. p.formFactor = "Symmetric"
  377. p.Size = Vector3.new(1, 1, 1)
  378. p.BrickColor = BrickColor.new("Really black")
  379. p.CanCollide = false
  380. p.Transparency = 1
  381. p.Locked = true
  382. p.TopSurface = 0
  383. p.BottomSurface = 0
  384. p.Parent = model
  385. local m = Instance.new("CylinderMesh")
  386. m.Scale = Vector3.new(0.4, 1, 0.4)
  387. m.Parent = p
  388. local w = Instance.new("Weld")
  389. w.Part0 = p
  390. w.Part1 = pm
  391. w.C0 = CFrame.new(0, 1.475, 0.075)
  392. w.C1 = CFrame.new()
  393. w.Parent = p
  394. end
  395.  
  396.  
  397. function removeParts(format)
  398. if format == "hand" then
  399. if Player.Character:FindFirstChild(Name) ~= nil then
  400. Player.Character[Name]:Remove()
  401. end
  402. elseif format == "holster" then
  403. if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  404. Player.Character[Name.. " (Holstered)"]:Remove()
  405. end
  406. end
  407. end
  408.  
  409.  
  410. function SetAngle(Joint, Angle, Character)
  411. if Character == nil then return false end
  412. Joints = {
  413. Character.Torso:FindFirstChild("Right Shoulder 2"),
  414. Character.Torso:FindFirstChild("Left Shoulder 2"),
  415. Character.Torso:FindFirstChild("Right Hip 2"),
  416. Character.Torso:FindFirstChild("Left Hip 2")
  417. }
  418. if Joints[Joint] == nil then return false end
  419. if Joint == 1 or Joint == 3 then
  420. Joints[Joint].DesiredAngle = Angle
  421. end
  422. if Joint == 2 or Joint == 4 then
  423. Joints[Joint].DesiredAngle = -Angle
  424. end
  425. end
  426.  
  427.  
  428. function ForceAngle(Joint, Angle, Character)
  429. if Character == nil then return false end
  430. Joints = {
  431. Character.Torso:FindFirstChild("Right Shoulder 2"),
  432. Character.Torso:FindFirstChild("Left Shoulder 2"),
  433. Character.Torso:FindFirstChild("Right Hip 2"),
  434. Character.Torso:FindFirstChild("Left Hip 2")
  435. }
  436. if Joints[Joint] == nil then return false end
  437. if Joint == 1 or Joint == 3 then
  438. Joints[Joint].CurrentAngle = Angle
  439. end
  440. if Joint == 2 or Joint == 4 then
  441. Joints[Joint].CurrentAngle = -Angle
  442. end
  443. end
  444.  
  445.  
  446. function SetSpeed(Joint, Speed, Character)
  447. if Character == nil then return false end
  448. Joints = {
  449. Character.Torso:FindFirstChild("Right Shoulder 2"),
  450. Character.Torso:FindFirstChild("Left Shoulder 2"),
  451. Character.Torso:FindFirstChild("Right Hip 2"),
  452. Character.Torso:FindFirstChild("Left Hip 2")
  453. }
  454. if Joints[Joint] == nil then return false end
  455. Joints[Joint].MaxVelocity = Speed
  456. end
  457.  
  458.  
  459. function DisableLimb(Limb, Character)
  460. if Character == nil then return false end
  461. if Character:FindFirstChild("Torso") == nil then return false end
  462. Joints = {
  463. Character.Torso:FindFirstChild("Right Shoulder"),
  464. Character.Torso:FindFirstChild("Left Shoulder"),
  465. Character.Torso:FindFirstChild("Right Hip"),
  466. Character.Torso:FindFirstChild("Left Hip")
  467. }
  468. Limbs = {
  469. Character:FindFirstChild("Right Arm"),
  470. Character:FindFirstChild("Left Arm"),
  471. Character:FindFirstChild("Right Leg"),
  472. Character:FindFirstChild("Left Leg")
  473. }
  474. if Joints[Limb] == nil then return false end
  475. if Limbs[Limb] == nil then return false end
  476. Joint = Instance.new("Motor")
  477. Joint.Parent = Character.Torso
  478. Joint.Part0 = Character.Torso
  479. Joint.Part1 = Limbs[Limb]
  480. Joint.MaxVelocity = 0.1
  481. if Limb == 1 then
  482. C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  483. C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  484. Joint.Name = "Right Shoulder 2"
  485. elseif Limb == 2 then
  486. C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  487. C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  488. Joint.Name = "Left Shoulder 2"
  489. elseif Limb == 3 then
  490. C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  491. C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  492. Joint.Name = "Right Hip 2"
  493. elseif(Limb == 4) then
  494. C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  495. C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  496. Joint.Name = "Left Hip 2"
  497. end
  498. Joint.C0 = C0
  499. Joint.C1 = C1
  500. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  501. Joints[Limb]:Remove()
  502. end
  503.  
  504.  
  505. function ResetLimbCFrame(Limb, Character)
  506. if Character == nil then return false end
  507. if Character.Parent == nil then return false end
  508. if Character:FindFirstChild("Torso") == nil then return false end
  509. Joints = {
  510. Character.Torso:FindFirstChild("Right Shoulder 2"),
  511. Character.Torso:FindFirstChild("Left Shoulder 2"),
  512. Character.Torso:FindFirstChild("Right Hip 2"),
  513. Character.Torso:FindFirstChild("Left Hip 2")
  514. }
  515. Limbs = {
  516. Character:FindFirstChild("Right Arm"),
  517. Character:FindFirstChild("Left Arm"),
  518. Character:FindFirstChild("Right Leg"),
  519. Character:FindFirstChild("Left Leg")
  520. }
  521. if Joints[Limb] == nil then return false end
  522. if Limbs[Limb] == nil then return false end
  523. if Limb == 1 then
  524. Joints[Limb].C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  525. Joints[Limb].C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  526. elseif Limb == 2 then
  527. Joints[Limb].C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  528. Joints[Limb].C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  529. elseif Limb == 3 then
  530. Joints[Limb].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  531. Joints[Limb].C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  532. elseif(Limb == 4) then
  533. Joints[Limb].C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  534. Joints[Limb].C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  535. end
  536. end
  537.  
  538.  
  539. function EnableLimb(Limb, Character)
  540. if Character == nil then return false end
  541. if Character:FindFirstChild("Torso") == nil then return false end
  542. Joints = {
  543. Character.Torso:FindFirstChild("Right Shoulder 2"),
  544. Character.Torso:FindFirstChild("Left Shoulder 2"),
  545. Character.Torso:FindFirstChild("Right Hip 2"),
  546. Character.Torso:FindFirstChild("Left Hip 2")
  547. }
  548. Limbs = {
  549. Character:FindFirstChild("Right Arm"),
  550. Character:FindFirstChild("Left Arm"),
  551. Character:FindFirstChild("Right Leg"),
  552. Character:FindFirstChild("Left Leg")
  553. }
  554. if Joints[Limb] == nil then return false end
  555. if Limbs[Limb] == nil then return false end
  556. if Limb == 1 then
  557. Joints[Limb].Name = "Right Shoulder"
  558. elseif Limb == 2 then
  559. Joints[Limb].Name = "Left Shoulder"
  560. elseif Limb == 3 then
  561. Joints[Limb].Name = "Right Hip"
  562. elseif Limb == 4 then
  563. Joints[Limb].Name = "Left Hip"
  564. end
  565. Animate = Character:FindFirstChild("Animate")
  566. if Animate == nil then return false end
  567. Animate = Animate:Clone()
  568. Character.Animate:Remove()
  569. Animate.Parent = Character
  570. end
  571.  
  572.  
  573. function playAnimation(format, mouse)
  574. if format == "normal" then
  575. if Player.Character:FindFirstChild("Torso") ~= nil then
  576. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  577. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  578. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-90))
  579. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  580. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  581. end
  582. end
  583. end
  584. if format == "fire" then
  585. if Player.Character:FindFirstChild("Torso") ~= nil then
  586. coroutine.resume(coroutine.create(function()
  587. for i, cam in ipairs(game.Workspace:GetChildren()) do
  588. if cam.className == "Camera" then
  589. if cam.CameraSubject == Player.Character:FindFirstChild("Humanoid") then
  590. local time = 7
  591. local seed = Vector3.new(math.random(100, 200) / 10000, math.random(100, 200) / 10000, 0)
  592. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  593. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  594. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  595. for i = 1, time do
  596. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  597. wait()
  598. end
  599. end
  600. end
  601. end
  602. end))
  603. end
  604. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  605. if silenced then
  606. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  607. Player.Character[Name].Handle.Fire.Pitch = math.random(20, 25) / 10
  608. Player.Character[Name].Handle.Fire:Play()
  609. else
  610. Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
  611. Player.Character[Name].Handle.Fire.Pitch = math.random(8, 12) / 10
  612. Player.Character[Name].Handle.Fire:Play()
  613. end
  614. end
  615. if Player.Character[Name]:FindFirstChild("ShellOut") ~= nil then
  616. local casing = Instance.new("Part")
  617. casing.Name = "Shell"
  618. casing.formFactor = "Symmetric"
  619. casing.Size = Vector3.new(1, 1, 1)
  620. casing.CFrame = CFrame.new(Player.Character[Name].ShellOut.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  621. casing.BrickColor = BrickColor.new("New Yeller")
  622. local mesh = Instance.new("CylinderMesh")
  623. mesh.Scale = Vector3.new(0.1, 0.3, 0.1)
  624. mesh.Parent = casing
  625. casing.Parent = game.Workspace
  626. casing:BreakJoints()
  627. casing.Velocity = (Player.Character[Name].ShellOut.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  628. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), casing)
  629. end
  630. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  631. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  632. end
  633. for i = 0, 10, 5 do
  634. if Player.Character:FindFirstChild("Torso") ~= nil then
  635. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  636. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  637. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  638. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  639. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  640. wait()
  641. end
  642. end
  643. end
  644. for i = 10, 0, -5 do
  645. if Player.Character:FindFirstChild("Torso") ~= nil then
  646. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  647. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  648. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  649. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  650. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  651. wait()
  652. end
  653. end
  654. end
  655. end
  656. if format == "reload" then
  657. Player.Character[Name].Handle.Reload:Play()
  658. for i = 0, 25, 5 do
  659. if Player.Character:FindFirstChild("Torso") ~= nil then
  660. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  661. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  662. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55 + (i / 50), 0.75 - (i / 50), 0.35 + (i / 22.5)) * CFrame.fromEulerAnglesXYZ(math.rad(315 - (i * 2)), math.rad(-i * 3.5), math.rad(-90))
  663. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  664. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  665. wait()
  666. end
  667. end
  668. end
  669. Player.Character[Name].Magazine.Transparency = 1
  670. magazineDrop = Player.Character[Name].Magazine:Clone()
  671. magazineDrop.Transparency = 0
  672. magazineDrop.Parent = game.Workspace
  673. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
  674. delay(0.1, function() magazineDrop.CanCollide = true end)
  675. magazineNew = Player.Character[Name].Magazine:Clone()
  676. magazineNew.Name = "New Magazine"
  677. magazineNew.Transparency = 0
  678. magazineNew.Parent = Player.Character[Name]
  679. local w = Instance.new("Weld")
  680. w.Part0 = magazineNew
  681. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  682. w.C0 = CFrame.new(0, 1.1, 0)
  683. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  684. w.Parent = magazineNew
  685. for i = 25, 0, -5 do
  686. if Player.Character:FindFirstChild("Torso") ~= nil then
  687. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  688. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  689. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55 + (i / 50), 0.75 - (i / 50), 0.35 + (i / 22.5)) * CFrame.fromEulerAnglesXYZ(math.rad(315 - (i * 2)), math.rad(-i * 3.5), math.rad(-90))
  690. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  691. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + ((25 - i) / 30), 0.5, 0.6 + ((25 - i) / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), math.rad((25 * 2) - (i * 2)))
  692. wait()
  693. end
  694. end
  695. end
  696. Player.Character[Name].Magazine.Transparency = 0
  697. Player.Character[Name]["New Magazine"]:Remove()
  698. for i = 25, 0, -5 do
  699. if Player.Character:FindFirstChild("Torso") ~= nil then
  700. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  701. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  702. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2)))
  703. wait()
  704. end
  705. end
  706. end
  707. wait(0.04)
  708. for i = 0, 5, 1 do
  709. if Player.Character:FindFirstChild("Torso") ~= nil then
  710. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  711. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  712. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  713. wait()
  714. end
  715. end
  716. end
  717. for i = 5, 0, -1 do
  718. if Player.Character:FindFirstChild("Torso") ~= nil then
  719. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  720. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  721. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  722. wait()
  723. end
  724. end
  725. end
  726. end
  727. end
  728.  
  729.  
  730. function Weld(x, y)
  731. weld = Instance.new("Weld")
  732. weld.Part0 = x
  733. weld.Part1 = y
  734. CJ = CFrame.new(x.Position)
  735. C0 = x.CFrame:inverse() * CJ
  736. C1 = y.CFrame:inverse() * CJ
  737. weld.C0 = C0
  738. weld.C1 = C1
  739. weld.Parent = x
  740. end
  741.  
  742.  
  743. function tagHumanoid(humanoid)
  744. local tag = Instance.new("ObjectValue")
  745. tag.Name = "creator"
  746. tag.Value = Player
  747. tag.Parent = humanoid
  748. end
  749.  
  750.  
  751. function untagHumanoid(humanoid)
  752. if humanoid ~= nil then
  753. local tag = humanoid:FindFirstChild("creator")
  754. if tag ~= nil then
  755. tag:Remove()
  756. end
  757. end
  758. end
  759.  
  760.  
  761. function fire(startPoint, endPoint)
  762. if startPoint == nil then return end
  763. if endPoint == nil then return end
  764. local pos, hit = RayCast(startPoint, endPoint, 100)
  765. local trail = Instance.new("Part")
  766. trail.Name = "Bullet Trail"
  767. trail.BrickColor = BrickColor.new("New Yeller")
  768. trail.TopSurface = 0
  769. trail.BottomSurface = 0
  770. trail.formFactor = 0
  771. trail.Size = Vector3.new(1, 1, 1)
  772. trail.Transparency = 0.3
  773. trail.Anchored = true
  774. trail.CanCollide = false
  775. trail.CFrame = CFrame.new((startPoint + pos) / 2, pos)
  776. trail.Parent = game.Workspace
  777. local mesh = Instance.new("SpecialMesh")
  778. mesh.MeshType = "Brick"
  779. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - pos).magnitude)
  780. mesh.Parent = trail
  781. coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
  782. if hit ~= nil then
  783. if hit.Parent == nil then return end
  784. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  785. tagHumanoid(hit.Parent.Humanoid)
  786. hit.Parent.Humanoid:TakeDamage(damage)
  787. if math.random(1, 10) == 1 then
  788. hit.Parent.Humanoid.Sit = true
  789. end
  790. untagHumanoid(humanoid)
  791. end
  792. if hit.Anchored == false then
  793. hit.Velocity = ((pos - startPoint) * 3) / hit:GetMass()
  794. hit.RotVelocity = Vector3.new(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) / hit:GetMass()
  795. end
  796. end
  797. end
  798.  
  799.  
  800. function onButton1Down(mouse)
  801. if selected == false then return end
  802. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true then
  803. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  804. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  805. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  806. Button1Down = true
  807. canFire = false
  808. canFire2 = true
  809. while canFire2 == true do
  810. local humanoid = Player.Character:FindFirstChild("Humanoid")
  811. if humanoid == nil then
  812. canFire2 = false
  813. break
  814. end
  815. if humanoid.Health <= 0 then
  816. canFire2 = false
  817. break
  818. end
  819. if automatic == false and burst ~= true then
  820. canFire2 = false
  821. end
  822. if burst == true then
  823. if burstCount >= burstCountMax then
  824. canFire2 = false
  825. burstCount = 0
  826. break
  827. end
  828. burstCount = burstCount + 1
  829. end
  830. if magazine.Value <= 0 then
  831. Player.Character[Name].Handle.Empty:Play()
  832. canFire2 = false
  833. break
  834. end
  835. magazine.Value = magazine.Value - 1
  836. updateGui()
  837. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p)
  838. coroutine.resume(coroutine.create(function() playAnimation("fire", mouse) end))
  839. wait(readyTime)
  840. end
  841. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  842. canFire = true
  843. end
  844. end
  845.  
  846.  
  847. function onButton1Up(mouse)
  848. if selected == false then return end
  849. Button1Down = false
  850. canFire2 = false
  851. burstCount = 0
  852. while canFire == false do wait() end
  853. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  854. end
  855.  
  856.  
  857. function onKeyDown(key, mouse)
  858. if selected == false then return end
  859. key = key:lower()
  860. if key == "q" and Button1Down == false and canFire == true then
  861. if mouse.Target == nil then return end
  862. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  863. onDeselected(mouse)
  864. removeParts("holster")
  865. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  866. end
  867. end
  868. if key == "e" and Button1Down == false and canFire == true then
  869. if silenced then
  870. silenced = false
  871. if Player.Character:FindFirstChild(Name) == nil then return end
  872. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  873. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  874. Player.Character[Name].Muzzle.Transparency = 1
  875. Player.Character[Name].Muzzle.Name = "Silencer"
  876. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  877. else
  878. silenced = true
  879. if Player.Character:FindFirstChild(Name) == nil then return end
  880. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  881. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  882. Player.Character[Name].Silencer.Transparency = 0
  883. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  884. Player.Character[Name].Silencer.Name = "Muzzle"
  885. end
  886. end
  887. if key == "r" and Button1Down == false and canFire == true then
  888. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  889. canFire = false
  890. burstCount = 0
  891. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  892. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  893. updateGui()
  894. coroutine.resume(coroutine.create(function() playAnimation("reload") end))
  895. wait(reloadTime)
  896. if ammo.Value - magazineMax.Value < 0 then
  897. magazine.Value = ammo.Value
  898. ammo.Value = 0
  899. elseif ammo.Value - magazineMax.Value >= 0 then
  900. ammo.Value = ammo.Value - magazineMax.Value
  901. magazine.Value = magazineMax.Value
  902. end
  903. updateGui()
  904. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  905. canFire = true
  906. end
  907. end
  908. end
  909.  
  910.  
  911. function onSelected(mouse)
  912. if selected == true or dropped == true then return end
  913. selected = true
  914. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  915. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  916. if Player.Character.WeaponActivated.Value == nil then break end
  917. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  918. wait()
  919. end
  920. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  921. updateGui()
  922. removeParts("holster")
  923. makeParts("hand")
  924. weapon = Instance.new("ObjectValue")
  925. weapon.Name = "WeaponActivated"
  926. weapon.Value = script.Parent
  927. weapon.Parent = Player.Character
  928. DisableLimb(1, Player.Character)
  929. DisableLimb(2, Player.Character)
  930. ForceAngle(1, 0, Player.Character)
  931. ForceAngle(2, 0, Player.Character)
  932. playAnimation("normal")
  933. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  934. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  935. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  936. end
  937.  
  938.  
  939. function onDeselected(mouse)
  940. if selected == false then return end
  941. selected = false
  942. while Button1Down == true do
  943. wait()
  944. end
  945. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  946. if Player.Character.WeaponActivated.Value == script.Parent then
  947. Player.Character.WeaponActivated:Remove()
  948. end
  949. end
  950. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  951. if Player.Character.WeaponActivated.Value == nil then break end
  952. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  953. wait()
  954. end
  955. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  956. removeParts("hand")
  957. makeParts("holster")
  958. silenced = false
  959. ForceAngle(1, 0, Player.Character)
  960. ForceAngle(2, 0, Player.Character)
  961. ResetLimbCFrame(1, Player.Character)
  962. ResetLimbCFrame(2, Player.Character)
  963. EnableLimb(1, Player.Character)
  964. EnableLimb(2, Player.Character)
  965. end
  966.  
  967.  
  968. if script.Parent.className ~= "HopperBin" then
  969. if Player == nil then print("Error: Player not found!") return end
  970. Tool = Instance.new("HopperBin")
  971. Tool.Name = Name
  972. Tool.Parent = Player.Backpack
  973. script.Name = "Main"
  974. script.Parent = Tool
  975. elseif script.Parent.className == "HopperBin" then
  976. while script.Parent.Parent.className ~= "Backpack" do
  977. wait()
  978. end
  979. if script.Parent:FindFirstChild("MagazineMax") == nil then
  980. magazineMax = Instance.new("NumberValue")
  981. magazineMax.Name = "MagazineMax"
  982. magazineMax.Value = 20
  983. magazineMax.Parent = script.Parent
  984. else
  985. magazineMax = script.Parent.MagazineMax
  986. end
  987. if script.Parent:FindFirstChild("Magazine") == nil then
  988. magazine = Instance.new("NumberValue")
  989. magazine.Name = "Magazine"
  990. magazine.Value = 0
  991. magazine.Parent = script.Parent
  992. else
  993. magazine = script.Parent.Magazine
  994. end
  995. if script.Parent:FindFirstChild("AmmoMax") == nil then
  996. ammoMax = Instance.new("NumberValue")
  997. ammoMax.Name = "AmmoMax"
  998. ammoMax.Value = 400
  999. ammoMax.Parent = script.Parent
  1000. else
  1001. ammoMax = script.Parent.AmmoMax
  1002. end
  1003. if script.Parent:FindFirstChild("Ammo") == nil then
  1004. ammo = Instance.new("NumberValue")
  1005. ammo.Name = "Ammo"
  1006. ammo.Value = script.Parent.AmmoMax.Value
  1007. ammo.Parent = script.Parent
  1008. else
  1009. ammo = script.Parent.Ammo
  1010. end
  1011. Player = script.Parent.Parent.Parent
  1012. makeParts("holster")
  1013. script.Parent.Selected:connect(onSelected)
  1014. script.Parent.Deselected:connect(onDeselected)
  1015. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement