Alex325

Artillery Beacon Script

Aug 22nd, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.89 KB | None | 0 0
  1. --[[
  2. Artillery Beacon
  3. Throw the marker and wait a few seconds, and then many shells smash your enemies to bits, or yourself, if you don't get away fast enough.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. Player = game:GetService("Players").LocalPlayer
  11. Char = Player.Character
  12. animate = Char:findFirstChild("Animate")
  13. if animate then
  14. animate:Destroy()
  15. end
  16. Name = "Artillery Beacon"
  17. selected = false
  18. Button1Down = false
  19. thrown = false
  20.  
  21.  
  22. function makeParts(format)
  23. local beacon = Instance.new("Model")
  24. beacon.Name = Name
  25. beacon.Parent = Player.Character
  26. local pm = Instance.new("Part")
  27. pm.Material = "SmoothPlastic"
  28. pm.Name = "Handle"
  29. pm.FormFactor = "Custom"
  30. pm.Size = Vector3.new(1, 1, 1)
  31. pm.BrickColor = BrickColor.new("Really black")
  32. pm.Locked = true
  33. pm.TopSurface = 0
  34. pm.BottomSurface = 0
  35. pm.Parent = beacon
  36. local m = Instance.new("SpecialMesh")
  37. m.MeshType = "Brick"
  38. m.Scale = Vector3.new(0.5, 1.25, 0.2)
  39. m.Parent = pm
  40. local w = Instance.new("Weld")
  41. w.Part0 = pm
  42. if format == "hand" then
  43. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  44. w.C0 = CFrame.new(-1.2, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(90))
  45. w.C1 = CFrame.new()
  46. elseif format == "holster" then
  47. w.Part1 = Player.Character:FindFirstChild("Torso")
  48. w.C0 = CFrame.new(0.7, 0.25, 0.6)
  49. w.C1 = CFrame.new()
  50. beacon.Name = Name.. " (Holstered)"
  51. end
  52. w.Parent = pm
  53. local s = Instance.new("Sound")
  54. s.Name = "Explode"
  55. s.SoundId = "http://www.roblox.com/Asset/?id=2101148"
  56. s.Volume = 1
  57. s.Pitch = 1
  58. s.Looped = false
  59. s.Parent = pm
  60. local s = Instance.new("Sound")
  61. s.Name = "Beep"
  62. s.SoundId = "http://www.roblox.com/Asset/?id=15666462"
  63. s.Volume = 1
  64. s.Pitch = 0.75
  65. s.Looped = true
  66. s.Parent = pm
  67. local p = Instance.new("Part")
  68. p.Material = "SmoothPlastic"
  69. p.Name = "Antenna"
  70. p.FormFactor = "Custom"
  71. p.Size = Vector3.new(1, 1, 1)
  72. p.BrickColor = BrickColor.new("Dark stone grey")
  73. p.Transparency = 0
  74. p.Locked = true
  75. p.TopSurface = 0
  76. p.BottomSurface = 0
  77. p.Parent = beacon
  78. local m = Instance.new("CylinderMesh")
  79. m.Scale = Vector3.new(0.1, 0.5, 0.1)
  80. m.Parent = p
  81. local w = Instance.new("Weld")
  82. w.Part0 = p
  83. w.Part1 = pm
  84. w.C0 = CFrame.new(0.1, -0.85, 0)
  85. w.C1 = CFrame.new()
  86. w.Parent = p
  87. local p = Instance.new("Part")
  88. p.Material = "SmoothPlastic"
  89. p.Name = "Light"
  90. p.FormFactor = "Custom"
  91. p.Size = Vector3.new(1, 1, 1)
  92. p.BrickColor = BrickColor.new("Bright green")
  93. p.Transparency = 1
  94. p.Locked = true
  95. p.TopSurface = 0
  96. p.BottomSurface = 0
  97. p.Parent = beacon
  98. local m = Instance.new("SpecialMesh")
  99. m.MeshType = "Sphere"
  100. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  101. m.Parent = p
  102. local w = Instance.new("Weld")
  103. w.Part0 = p
  104. w.Part1 = pm
  105. w.C0 = CFrame.new(-0.175, -0.64, 0)
  106. w.C1 = CFrame.new()
  107. w.Parent = p
  108. end
  109.  
  110.  
  111. function removeParts(format)
  112. if format == "hand" then
  113. if Player.Character:FindFirstChild(Name) ~= nil then
  114. Player.Character[Name]:Remove()
  115. end
  116. elseif format == "holster" then
  117. if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  118. Player.Character[Name.. " (Holstered)"]:Remove()
  119. end
  120. end
  121. end
  122.  
  123.  
  124. function SetAngle(Joint, Angle, Character)
  125. if Character == nil then return false end
  126. local Joints = {
  127. Character.Torso:FindFirstChild("Right Shoulder 2"),
  128. Character.Torso:FindFirstChild("Left Shoulder 2"),
  129. Character.Torso:FindFirstChild("Right Hip 2"),
  130. Character.Torso:FindFirstChild("Left Hip 2")
  131. }
  132. if Joints[Joint] == nil then return false end
  133. if Joint == 1 or Joint == 3 then
  134. Joints[Joint].DesiredAngle = Angle
  135. end
  136. if Joint == 2 or Joint == 4 then
  137. Joints[Joint].DesiredAngle = -Angle
  138. end
  139. end
  140.  
  141.  
  142. function ForceAngle(Joint, Angle, Character)
  143. if Character == nil then return false end
  144. local Joints = {
  145. Character.Torso:FindFirstChild("Right Shoulder 2"),
  146. Character.Torso:FindFirstChild("Left Shoulder 2"),
  147. Character.Torso:FindFirstChild("Right Hip 2"),
  148. Character.Torso:FindFirstChild("Left Hip 2")
  149. }
  150. if Joints[Joint] == nil then return false end
  151. if Joint == 1 or Joint == 3 then
  152. Joints[Joint].DesiredAngle = Angle
  153. Joints[Joint].CurrentAngle = Angle
  154. end
  155. if Joint == 2 or Joint == 4 then
  156. Joints[Joint].DesiredAngle = -Angle
  157. Joints[Joint].CurrentAngle = -Angle
  158. end
  159. end
  160.  
  161.  
  162. function SetSpeed(Joint, Speed, Character)
  163. if Character == nil then return false end
  164. local Joints = {
  165. Character.Torso:FindFirstChild("Right Shoulder 2"),
  166. Character.Torso:FindFirstChild("Left Shoulder 2"),
  167. Character.Torso:FindFirstChild("Right Hip 2"),
  168. Character.Torso:FindFirstChild("Left Hip 2")
  169. }
  170. if Joints[Joint] == nil then return false end
  171. Joints[Joint].MaxVelocity = Speed
  172. end
  173.  
  174.  
  175. function DisableLimb(Limb, Character)
  176. if Character == nil then return false end
  177. if Character:FindFirstChild("Torso") == nil then return false end
  178. local Joints = {
  179. Character.Torso:FindFirstChild("Right Shoulder"),
  180. Character.Torso:FindFirstChild("Left Shoulder"),
  181. Character.Torso:FindFirstChild("Right Hip"),
  182. Character.Torso:FindFirstChild("Left Hip")
  183. }
  184. local Limbs = {
  185. Character:FindFirstChild("Right Arm"),
  186. Character:FindFirstChild("Left Arm"),
  187. Character:FindFirstChild("Right Leg"),
  188. Character:FindFirstChild("Left Leg")
  189. }
  190. if Joints[Limb] == nil then return false end
  191. if Limbs[Limb] == nil then return false end
  192. local Joint = Instance.new("Motor")
  193. Joint.Parent = Character.Torso
  194. Joint.Part0 = Character.Torso
  195. Joint.Part1 = Limbs[Limb]
  196. if Limb == 1 then
  197. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  198. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  199. Joint.Name = "Right Shoulder 2"
  200. elseif Limb == 2 then
  201. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  202. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  203. Joint.Name = "Left Shoulder 2"
  204. elseif Limb == 3 then
  205. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  206. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  207. Joint.Name = "Right Hip 2"
  208. elseif Limb == 4 then
  209. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  210. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  211. Joint.Name = "Left Hip 2"
  212. end
  213. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  214. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  215. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  216. Joints[Limb]:Remove()
  217. end
  218.  
  219.  
  220. function ResetLimbCFrame(Limb, Character)
  221. if Character == nil then return false end
  222. if Character.Parent == nil then return false end
  223. if Character:FindFirstChild("Torso") == nil then return false end
  224. local Joints = {
  225. Character.Torso:FindFirstChild("Right Shoulder 2"),
  226. Character.Torso:FindFirstChild("Left Shoulder 2"),
  227. Character.Torso:FindFirstChild("Right Hip 2"),
  228. Character.Torso:FindFirstChild("Left Hip 2")
  229. }
  230. local Limbs = {
  231. Character:FindFirstChild("Right Arm"),
  232. Character:FindFirstChild("Left Arm"),
  233. Character:FindFirstChild("Right Leg"),
  234. Character:FindFirstChild("Left Leg")
  235. }
  236. if Joints[Limb] == nil then return false end
  237. if Limbs[Limb] == nil then return false end
  238. if Limb == 1 then
  239. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  240. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  241. elseif Limb == 2 then
  242. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  243. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  244. elseif Limb == 3 then
  245. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  246. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  247. elseif Limb == 4 then
  248. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  249. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  250. end
  251. end
  252.  
  253.  
  254. function EnableLimb(Limb, Character)
  255. if Character == nil then return false end
  256. if Character:FindFirstChild("Torso") == nil then return false end
  257. local Joints = {
  258. Character.Torso:FindFirstChild("Right Shoulder 2"),
  259. Character.Torso:FindFirstChild("Left Shoulder 2"),
  260. Character.Torso:FindFirstChild("Right Hip 2"),
  261. Character.Torso:FindFirstChild("Left Hip 2")
  262. }
  263. local Limbs = {
  264. Character:FindFirstChild("Right Arm"),
  265. Character:FindFirstChild("Left Arm"),
  266. Character:FindFirstChild("Right Leg"),
  267. Character:FindFirstChild("Left Leg")
  268. }
  269. if Joints[Limb] == nil then return false end
  270. if Limbs[Limb] == nil then return false end
  271. if Limb == 1 then
  272. Joints[Limb].Name = "Right Shoulder"
  273. elseif Limb == 2 then
  274. Joints[Limb].Name = "Left Shoulder"
  275. elseif Limb == 3 then
  276. Joints[Limb].Name = "Right Hip"
  277. elseif Limb == 4 then
  278. Joints[Limb].Name = "Left Hip"
  279. end
  280. Animate = Character:FindFirstChild("Animate")
  281. if Animate == nil then return false end
  282. Animate = Animate:Clone()
  283. Character.Animate:Remove()
  284. Animate.Parent = Character
  285. end
  286.  
  287.  
  288. function Weld(x, y)
  289. local weld = Instance.new("Weld")
  290. weld.Part0 = x
  291. weld.Part1 = y
  292. CJ = CFrame.new(x.Position)
  293. C0 = x.CFrame:inverse() * CJ
  294. C1 = y.CFrame:inverse() * CJ
  295. weld.C0 = C0
  296. weld.C1 = C1
  297. weld.Parent = x
  298. end
  299.  
  300.  
  301. function tagHumanoid(humanoid)
  302. local tag = Instance.new("ObjectValue")
  303. tag.Name = "creator"
  304. tag.Value = Player
  305. tag.Parent = humanoid
  306. local tag = Instance.new("StringValue")
  307. tag.Name = "creatorType1"
  308. tag.Value = Name
  309. tag.Parent = humanoid
  310. local tag = Instance.new("StringValue")
  311. tag.Name = "creatorType2"
  312. tag.Value = "blown to pieces"
  313. tag.Parent = humanoid
  314. end
  315.  
  316.  
  317. function untagHumanoid(humanoid)
  318. if humanoid ~= nil then
  319. local tag = humanoid:FindFirstChild("creator")
  320. if tag ~= nil then
  321. tag:Remove()
  322. end
  323. local tag = humanoid:FindFirstChild("creatorType1")
  324. if tag ~= nil then
  325. tag:Remove()
  326. end
  327. local tag = humanoid:FindFirstChild("creatorType2")
  328. if tag ~= nil then
  329. tag:Remove()
  330. end
  331. end
  332. end
  333.  
  334.  
  335. function fire(v)
  336. if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
  337. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  338. if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
  339. local bodyVelocity = Instance.new("BodyVelocity")
  340. bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  341. bodyVelocity.velocity = v * 75
  342. bodyVelocity.Parent = Player.Character[Name].Handle
  343. wait(0.1)
  344. bodyVelocity:Remove()
  345. end
  346.  
  347.  
  348. function onButton1Down(mouse)
  349. if selected == false then return end
  350. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down ~= true and thrown ~= true then
  351. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  352. if Player.Character[Name]:FindFirstChild("Antenna") == nil then return end
  353. if Player.Character[Name]:FindFirstChild("Light") == nil then return end
  354. Button1Down = true
  355. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  356. Player.Character[Name].Light.Transparency = 0.4
  357. coroutine.resume(coroutine.create(function(target)
  358. local pos1 = target.Position
  359. local pos2 = pos1
  360. while true do
  361. if target == nil then return end
  362. if target.Parent == nil then return end
  363. pos2 = pos1
  364. pos1 = target.Position
  365. local trail = Instance.new("Part")
  366. trail.Material = "SmoothPlastic"
  367. trail.BrickColor = target.BrickColor
  368. trail.TopSurface = 0
  369. trail.BottomSurface = 0
  370. trail.FormFactor = target.FormFactor
  371. trail.Size = Vector3.new(1, 1, 1)
  372. trail.Reflectance = 0
  373. trail.Transparency = 0.3
  374. trail.Anchored = true
  375. trail.CanCollide = false
  376. trail.CFrame = CFrame.new((pos1 + pos2) / 2, pos2)
  377. trail.Parent = Workspace
  378. local mesh = Instance.new("SpecialMesh")
  379. mesh.MeshType = "Brick"
  380. mesh.Scale = Vector3.new(0.2, 0.2, (pos2 - pos1).magnitude)
  381. mesh.Parent = trail
  382. coroutine.resume(coroutine.create(function(part) for i = 3, 10, 1 do part.Transparency = i / 10 wait(0.1) end part:Remove() end), trail)
  383. wait()
  384. end
  385. end), Player.Character[Name].Light)
  386. wait(0.5)
  387. Player.Character[Name].Handle.Beep:Play()
  388. Player.Character[Name].Light.BrickColor = BrickColor.new("Bright orange")
  389. coroutine.resume(coroutine.create(function()
  390. wait(3)
  391. if Player.Character:FindFirstChild(Name) ~= nil then
  392. if Player.Character[Name]:FindFirstChild("Light") ~= nil then Player.Character[Name].Light.BrickColor = BrickColor.new("Really red") end
  393. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then Player.Character[Name].Handle.Beep.Pitch = 1.25 end
  394. local position = Player.Character[Name].Handle.Position
  395. local s = Player.Character[Name].Handle.Explode:Clone()
  396. coroutine.resume(coroutine.create(function()
  397. local weld1 = Player.Character[Name].Light:FindFirstChild("Weld")
  398. local weld2 = Player.Character[Name].Antenna:FindFirstChild("Weld")
  399. if weld1 == nil then return end
  400. if weld2 == nil then return end
  401. local weld1c = weld1:Clone()
  402. local weld2c = weld2:Clone()
  403. while true do
  404. if Player.Character ~= nil then
  405. if Player.Character:FindFirstChild(Name) ~= nil then
  406. if weld1.Parent == nil then
  407. if Player.Character[Name]:FindFirstChild("Light") ~= nil then
  408. weld1c:Clone().Parent = Player.Character[Name].Light
  409. Player.Character[Name]:MakeJoints()
  410. end
  411. end
  412. if weld2.Parent == nil then
  413. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  414. weld2c:Clone().Parent = Player.Character[Name].Antenna
  415. Player.Character[Name]:MakeJoints()
  416. end
  417. end
  418. end
  419. end
  420. wait()
  421. end
  422. end))
  423. for i = 0, math.random(30, 50) do
  424. if Player.Character:FindFirstChild("Humanoid") ~= nil then
  425. if Player.Character.Humanoid.Health <= 0 then break end
  426. local shell = Instance.new("Part")
  427. shell.Material = "SmoothPlastic"
  428. shell.Name = "Artillery Shell"
  429. shell.Anchored = true
  430. shell.BrickColor = BrickColor.new("Medium stone grey")
  431. shell.FormFactor = "Custom"
  432. shell.Size = Vector3.new(2, 5, 2)
  433. shell.TopSurface = 0
  434. shell.BottomSurface = 0
  435. shell.Parent = Workspace
  436. shellmesh = Instance.new("SpecialMesh",shell)
  437. shellmesh.MeshType = "FileMesh"
  438. shellmesh.MeshId = "http://roblox.com/asset/?id=2251534"
  439. shellmesh.TextureId = "http://www.roblox.com/asset/?id=74320150"
  440. shellmesh.Scale = Vector3.new(1,1,1)
  441. coroutine.resume(coroutine.create(function(part)
  442. local offset = Vector3.new(math.random(-100, 100), math.random(-50, 50), math.random(-100, 100))
  443. for i = 1000, 0, -25 do
  444. part.CFrame = CFrame.new((position + offset) + Vector3.new(0, i, 0))
  445. wait()
  446. end
  447. local e = Instance.new("Explosion")
  448. e.Position = part.Position
  449. e.BlastPressure = 500000
  450. e.BlastRadius = 25
  451. e.Parent = Workspace
  452. e.Hit:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then tagHumanoid(hit.Parent.Humanoid) delay(1, function() untagHumanoid(hit.Parent.Humanoid) end) end end)
  453. local s2 = s:Clone()
  454. s2.Pitch = math.random(70, 90) / 100
  455. s2.Parent = Workspace
  456. s2:Play()
  457. part:Remove()
  458. end), shell)
  459. end
  460. wait(math.random(1, 5) / 10)
  461. end
  462. if Player.Character:FindFirstChild(Name) ~= nil then if Player.Character[Name]:FindFirstChild("Handle") ~= nil then Player.Character[Name].Handle.Beep:Stop() end end
  463. end
  464. wait(1)
  465. removeParts("hand")
  466. wait(1)
  467. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  468. Player.Character.WeaponActivated:Remove()
  469. end
  470. thrown = false
  471. Button1Down = false
  472. selected = true
  473. onDeselected(mouse)
  474. removeParts("holster")
  475. script.Parent:Remove()
  476. end))
  477. end
  478. end
  479.  
  480.  
  481. function onButton1Up(mouse)
  482. if selected == false then return end
  483. if Button1Down == true and thrown ~= true then
  484. thrown = true
  485. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  486. SetSpeed(1, 0.75, Player.Character)
  487. SetAngle(1, 0, Player.Character)
  488. EnableLimb(1, Player.Character)
  489. fire((mouse.Hit.p - Player.Character[Name].Handle.Position).unit)
  490. end
  491. Button1Down = false
  492. end
  493.  
  494.  
  495. function onKeyDown(key, mouse)
  496. if selected == false then return end
  497. key = key:lower()
  498. if key == "q" and Button1Down == false and thrown ~= true then
  499. if mouse.Target == nil then return end
  500. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  501. onDeselected(mouse)
  502. removeParts("holster")
  503. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  504. end
  505. end
  506. end
  507.  
  508.  
  509. function onSelected(mouse)
  510. if selected == true then return end
  511. selected = true
  512. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  513. while Player.Character:FindFirstChild("WeaponActivated") ~= nil or thrown == true do
  514. if Player.Character.WeaponActivated.Value == nil then break end
  515. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  516. wait()
  517. end
  518. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  519. removeParts("holster")
  520. makeParts("hand")
  521. local weapon = Instance.new("ObjectValue")
  522. weapon.Name = "WeaponActivated"
  523. weapon.Value = script.Parent
  524. weapon.Parent = Player.Character
  525. DisableLimb(1, Player.Character)
  526. SetAngle(1, math.rad(200), Player.Character)
  527. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  528. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  529. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  530. end
  531.  
  532.  
  533. function onDeselected(mouse)
  534. if selected == false then return end
  535. selected = false
  536. while Button1Down == true or thrown == true do
  537. wait()
  538. end
  539. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  540. if Player.Character.WeaponActivated.Value == script.Parent then
  541. Player.Character.WeaponActivated:Remove()
  542. end
  543. end
  544. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  545. if Player.Character.WeaponActivated.Value == nil then break end
  546. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  547. wait()
  548. end
  549. removeParts("hand")
  550. makeParts("holster")
  551. SetAngle(1, 0, Player.Character)
  552. EnableLimb(1, Player.Character)
  553. end
  554.  
  555.  
  556. if script.Parent.ClassName ~= "HopperBin" then
  557. if Player == nil then print("Error: Player not found!") return end
  558. Tool = Instance.new("HopperBin")
  559. Tool.Name = Name
  560. Tool.Parent = Player.Backpack
  561. script.Name = "Main"
  562. script.Parent = Tool
  563. end wait() if script.Parent.ClassName == "HopperBin" then
  564. while script.Parent.Parent.ClassName ~= "Backpack" do
  565. wait()
  566. end
  567. Player = script.Parent.Parent.Parent
  568. makeParts("holster")
  569. script.Parent.Selected:connect(onSelected)
  570. script.Parent.Deselected:connect(onDeselected)
  571. end
Add Comment
Please, Sign In to add comment