Advertisement
Animescapetower

TOOLS

Apr 7th, 2018
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.75 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Tool0 = Instance.new("Tool")
  19. Script1 = Instance.new("Script")
  20. Script2 = Instance.new("Script")
  21. Script3 = Instance.new("Script")
  22. Part4 = Instance.new("Part")
  23. SpecialMesh5 = Instance.new("SpecialMesh")
  24. Sound6 = Instance.new("Sound")
  25. LocalScript7 = Instance.new("LocalScript")
  26. Tool8 = Instance.new("Tool")
  27. Part9 = Instance.new("Part")
  28. SpecialMesh10 = Instance.new("SpecialMesh")
  29. LocalScript11 = Instance.new("LocalScript")
  30. Sound12 = Instance.new("Sound")
  31. Sound13 = Instance.new("Sound")
  32. Script14 = Instance.new("Script")
  33. LocalScript15 = Instance.new("LocalScript")
  34. Tool16 = Instance.new("Tool")
  35. Script17 = Instance.new("Script")
  36. Script18 = Instance.new("Script")
  37. Part19 = Instance.new("Part")
  38. SpecialMesh20 = Instance.new("SpecialMesh")
  39. Sound21 = Instance.new("Sound")
  40. LocalScript22 = Instance.new("LocalScript")
  41. Tool0.Name = "ClassicPaintballGun"
  42. Tool0.Parent = mas
  43. Tool0.TextureId = "rbxasset://Textures/PaintballIcon.png"
  44. Tool0.GripForward = Vector3.new(0, -1, 0)
  45. Tool0.GripPos = Vector3.new(0, 0.400000006, 0.5)
  46. Tool0.GripUp = Vector3.new(0, 0, -1)
  47. Script1.Name = "Paintball"
  48. Script1.Parent = Tool0
  49. Script1.Disabled = true
  50. table.insert(cors,sandbox(Script1,function()
  51. ball = script.Parent
  52. damage =34
  53. SummonMaterialTypes = {"Neon","Granite","Glass","Plastic"}
  54. SummonMaterialChooser = SummonMaterialTypes[math.random(1,#SummonMaterialTypes)]
  55.  
  56. function onTouched(hit)
  57. local humanoid = hit.Parent:findFirstChild("Humanoid")
  58.  
  59.  
  60. if hit:getMass() < 1.2 * 200 then
  61. hit.BrickColor = ball.BrickColor
  62. end
  63. -- make a splat
  64. for i=1,3 do
  65. local s = Instance.new("Part")
  66. s.Shape = 1 -- block
  67. s.formFactor = 2 -- plate
  68. s.Size = Vector3.new(1,.4,1)
  69. s.BrickColor = ball.BrickColor
  70. local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1))
  71. s.Velocity = 15 * v
  72. s.CFrame = CFrame.new(ball.Position + v, v)
  73. s.Parent = game.Workspace
  74.  
  75.  
  76. while true do
  77. wait(0.5)
  78. s.Material = SummonMaterialChooser
  79.  
  80. end
  81.  
  82.  
  83. end
  84.  
  85.  
  86. if humanoid ~= nil then
  87. tagHumanoid(humanoid)
  88. humanoid:TakeDamage(damage)
  89. wait(2)
  90. untagHumanoid(humanoid)
  91. end
  92.  
  93. connection:disconnect()
  94. ball.Parent = nil
  95. end
  96.  
  97. function tagHumanoid(humanoid)
  98. -- todo: make tag expire
  99. local tag = ball:findFirstChild("creator")
  100. if tag ~= nil then
  101. local new_tag = tag:clone()
  102. new_tag.Parent = humanoid
  103. end
  104. end
  105.  
  106.  
  107. function untagHumanoid(humanoid)
  108. if humanoid ~= nil then
  109. local tag = humanoid:findFirstChild("creator")
  110. if tag ~= nil then
  111. tag.Parent = nil
  112. end
  113. end
  114. end
  115.  
  116. connection = ball.Touched:connect(onTouched)
  117.  
  118. wait(8)
  119. ball.Parent = nil
  120.  
  121. end))
  122. Script2.Name = "PaintballShooter"
  123. Script2.Parent = Tool0
  124. table.insert(cors,sandbox(Script2,function()
  125. Tool = script.Parent
  126.  
  127. colors = {45, 119, 21, 24, 23, 105, 104}
  128. SummonMaterialTypes = {"Neon","Granite","Glass","Plastic"}--You can add more
  129. SummonMaterialChooser = SummonMaterialTypes[math.random(1,#SummonMaterialTypes)]
  130. function fire(v)
  131.  
  132. Tool.Handle.Fire:play()
  133.  
  134.  
  135. local vCharacter = Tool.Parent
  136. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  137.  
  138. local missile = Instance.new("Part")
  139.  
  140.  
  141.  
  142. local spawnPos = vCharacter.PrimaryPart.Position
  143.  
  144.  
  145.  
  146. spawnPos = spawnPos + (v * 8)
  147.  
  148. missile.Position = spawnPos
  149. missile.Size = Vector3.new(1,1,1)
  150. missile.Velocity = v * 100
  151. missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
  152. missile.Material = SummonMaterialChooser
  153. missile.Shape = 0
  154. missile.BottomSurface = 0
  155. missile.TopSurface = 0
  156. missile.Name = "Paintball"
  157. missile.Elasticity = 0
  158. missile.Reflectance = 0
  159. missile.Friction = .9
  160.  
  161. local force = Instance.new("BodyForce")
  162. force.force = Vector3.new(0,90 * missile:GetMass(),0)
  163. force.Parent = missile
  164.  
  165. Script3:clone().Parent = missile
  166.  
  167. local new_script = script.Parent.Paintball:clone()
  168. new_script.Disabled = false
  169. new_script.Parent = missile
  170.  
  171. local creator_tag = Instance.new("ObjectValue")
  172. creator_tag.Value = vPlayer
  173. creator_tag.Name = "creator"
  174. creator_tag.Parent = missile
  175.  
  176.  
  177.  
  178. missile.Parent = game.Workspace
  179.  
  180.  
  181.  
  182. end
  183.  
  184.  
  185.  
  186. Tool.Enabled = true
  187. function onActivated()
  188.  
  189. if not Tool.Enabled then
  190. return
  191. end
  192.  
  193. Tool.Enabled = false
  194.  
  195. local character = Tool.Parent;
  196. local humanoid = character.Humanoid
  197. if humanoid == nil then
  198. print("Humanoid not found")
  199. return
  200. end
  201.  
  202. local targetPos = humanoid.TargetPoint
  203. local lookAt = (targetPos - character.Head.Position).unit
  204.  
  205. fire(lookAt)
  206.  
  207. wait(.5)
  208.  
  209. Tool.Enabled = true
  210. end
  211.  
  212.  
  213. script.Parent.Activated:connect(onActivated)
  214.  
  215. end))
  216. Script3.Name = "BrickCleanup"
  217. Script3.Parent = Tool0
  218. Script3.Disabled = true
  219. table.insert(cors,sandbox(Script3,function()
  220. -- this script removes its parent from the workspace after 120 seconds
  221.  
  222.  
  223. end))
  224. Part4.Name = "Handle"
  225. Part4.Parent = Tool0
  226. Part4.Rotation = Vector3.new(90, 0, -90)
  227. Part4.FormFactor = Enum.FormFactor.Symmetric
  228. Part4.Size = Vector3.new(1, 3, 2)
  229. Part4.CFrame = CFrame.new(31.8999977, 0.500001013, -83.3999939, -0, 1, -0, -0, 0, -1, -1, 0, -0)
  230. Part4.BottomSurface = Enum.SurfaceType.Smooth
  231. Part4.TopSurface = Enum.SurfaceType.Smooth
  232. Part4.Position = Vector3.new(31.8999977, 0.500001013, -83.3999939)
  233. Part4.Orientation = Vector3.new(90, 90, 0)
  234. SpecialMesh5.Parent = Part4
  235. SpecialMesh5.MeshId = "rbxasset://fonts/PaintballGun.mesh"
  236. SpecialMesh5.TextureId = "rbxasset://textures/PaintballGunTex128.png"
  237. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  238. Sound6.Name = "Fire"
  239. Sound6.Parent = Part4
  240. Sound6.SoundId = "rbxasset://sounds//paintball.wav"
  241. Sound6.Volume = 1
  242. LocalScript7.Name = "MouseIcon"
  243. LocalScript7.Parent = Tool0
  244. table.insert(cors,sandbox(LocalScript7,function()
  245. local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
  246. local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
  247.  
  248. local Tool = script.Parent
  249.  
  250. local Mouse = nil
  251.  
  252. local function UpdateIcon()
  253. if Mouse then
  254. Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
  255. end
  256. end
  257.  
  258. local function OnEquipped(mouse)
  259. Mouse = mouse
  260. UpdateIcon()
  261. end
  262.  
  263. local function OnChanged(property)
  264. if property == 'Enabled' then
  265. UpdateIcon()
  266. end
  267. end
  268.  
  269. Tool.Equipped:connect(OnEquipped)
  270. Tool.Changed:connect(OnChanged)
  271.  
  272. end))
  273. Tool8.Name = "RocketLauncher"
  274. Tool8.Parent = mas
  275. Tool8.TextureId = "http://www.roblox.com/asset/?id=90021376"
  276. Tool8.GripForward = Vector3.new(1, -0, -0)
  277. Tool8.GripPos = Vector3.new(0.699999988, 0, -0.5)
  278. Tool8.GripRight = Vector3.new(0, -1, 0)
  279. Tool8.GripUp = Vector3.new(0, 0, 1)
  280. Tool8.CanBeDropped = false
  281. Part9.Name = "Handle"
  282. Part9.Parent = Tool8
  283. Part9.Rotation = Vector3.new(-90, 0, 0)
  284. Part9.CanCollide = false
  285. Part9.FormFactor = Enum.FormFactor.Custom
  286. Part9.Size = Vector3.new(4.92000628, 0.740000546, 0.839999795)
  287. Part9.CFrame = CFrame.new(12.1399984, 0.420035988, -89.1699982, 1, 0, 0, 0, 6.30170107e-05, 1.00000024, 0, -1.00000024, 6.30170107e-05)
  288. Part9.BottomSurface = Enum.SurfaceType.Smooth
  289. Part9.TopSurface = Enum.SurfaceType.Smooth
  290. Part9.Position = Vector3.new(12.1399984, 0.420035988, -89.1699982)
  291. Part9.Orientation = Vector3.new(-90, 0, 0)
  292. SpecialMesh10.Parent = Part9
  293. SpecialMesh10.MeshId = "rbxasset://fonts/rocketlauncher.mesh"
  294. SpecialMesh10.Scale = Vector3.new(0.75, 0.75, 0.75)
  295. SpecialMesh10.TextureId = "rbxasset://textures/rocketlaunchertex.png"
  296. SpecialMesh10.MeshType = Enum.MeshType.FileMesh
  297. SpecialMesh10.Scale = Vector3.new(0.75, 0.75, 0.75)
  298. LocalScript11.Name = "Launcher"
  299. LocalScript11.Parent = Tool8
  300. table.insert(cors,sandbox(LocalScript11,function()
  301. -----------------
  302. --| Constants |--
  303. -----------------
  304. SummonMaterialTypes2 = {"Neon","Granite","Glass","Plastic"}--You can add more
  305. SummonMaterialChooser2 = SummonMaterialTypes2[math.random(1,#SummonMaterialTypes2)]
  306. SizeChooser = {1,0.1,0.3,0.4,0.5,0.7,5,6,2}
  307. SizeChooser2 = SizeChooser[math.random(1,#SizeChooser)]
  308.  
  309. local GRAVITY_ACCELERATION = 196.2
  310.  
  311. local RELOAD_TIME = 3 -- Seconds until tool can be used again
  312. local ROCKET_SPEED = 60 -- Speed of the projectile
  313.  
  314. local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
  315. local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
  316. local ROCKET_PART_SIZE = Vector3.new(SizeChooser2,SizeChooser2,SizeChooser2)
  317.  
  318. -----------------
  319. --| Variables |--
  320. -----------------
  321.  
  322. local DebrisService = Game:GetService('Debris')
  323. local PlayersService = Game:GetService('Players')
  324.  
  325. local MyPlayer = PlayersService.LocalPlayer
  326.  
  327. local Tool = script.Parent
  328. local ToolHandle = Tool.Handle
  329.  
  330. local RocketScript = script:WaitForChild('Rocket')
  331. local SwooshSound = script:WaitForChild('Swoosh')
  332. local BoomSound = script:WaitForChild('Boom')
  333.  
  334. --NOTE: We create the rocket once and then clone it when the player fires
  335. local Rocket = Instance.new('Part') do
  336. -- Set up the rocket part
  337. Rocket.Name = 'Rocket'
  338. Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
  339. Rocket.Size = ROCKET_PART_SIZE
  340. Rocket.CanCollide = false
  341. Rocket.Material = SummonMaterialChooser2
  342.  
  343. -- Add the mesh
  344. local mesh = Instance.new('SpecialMesh', Rocket)
  345. mesh.MeshType = "Brick"
  346. mesh.Scale = MISSILE_MESH_SCALE
  347.  
  348. -- Add fire
  349. local fire = Instance.new('Fire', Rocket)
  350. fire.Heat = 5
  351. fire.Size = 2
  352.  
  353. -- Add a force to counteract gravity
  354. local bodyForce = Instance.new('BodyForce', Rocket)
  355. bodyForce.Name = 'Antigravity'
  356. bodyForce.force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)
  357.  
  358. -- Clone the sounds and set Boom to PlayOnRemove
  359. local swooshSoundClone = SwooshSound:Clone()
  360. swooshSoundClone.Parent = Rocket
  361. local boomSoundClone = BoomSound:Clone()
  362. boomSoundClone.PlayOnRemove = true
  363. boomSoundClone.Parent = Rocket
  364.  
  365. -- Attach creator tags to the rocket early on
  366. local creatorTag = Instance.new('ObjectValue', Rocket)
  367. creatorTag.Value = MyPlayer
  368. creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  369. local iconTag = Instance.new('StringValue', creatorTag)
  370. iconTag.Value = Tool.TextureId
  371. iconTag.Name = 'icon'
  372.  
  373. -- Finally, clone the rocket script and enable it
  374. local rocketScriptClone = RocketScript:Clone()
  375. rocketScriptClone.Parent = Rocket
  376. rocketScriptClone.Disabled = false
  377.  
  378. end
  379.  
  380. -----------------
  381. --| Functions |--
  382. -----------------
  383.  
  384. local function OnActivated()
  385. local myModel = MyPlayer.Character
  386. if Tool.Enabled and myModel and myModel:FindFirstChild('Humanoid') and myModel.Humanoid.Health > 0 then
  387. Tool.Enabled = false
  388.  
  389. -- Create a clone of Rocket and set its color
  390. local rocketClone = Rocket:Clone()
  391. DebrisService:AddItem(rocketClone, 30)
  392. rocketClone.BrickColor = MyPlayer.TeamColor
  393.  
  394. -- Position the rocket clone and launch!
  395. local spawnPosition = (ToolHandle.CFrame * CFrame.new(2, 0, 0)).p
  396. rocketClone.CFrame = CFrame.new(spawnPosition, myModel.Humanoid.TargetPoint) --NOTE: This must be done before assigning Parent
  397. rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED --NOTE: This should be done before assigning Parent
  398. rocketClone.Parent = Workspace
  399.  
  400. wait(RELOAD_TIME)
  401.  
  402. Tool.Enabled = true
  403. end
  404. end
  405.  
  406. --------------------
  407. --| Script Logic |--
  408. --------------------
  409.  
  410. Tool.Activated:connect(OnActivated)
  411.  
  412. end))
  413. Sound12.Name = "Swoosh"
  414. Sound12.Parent = LocalScript11
  415. Sound12.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
  416. Sound12.Volume = 0.69999998807907
  417. Sound12.Looped = true
  418. Sound13.Name = "Boom"
  419. Sound13.Parent = LocalScript11
  420. Sound13.SoundId = "rbxasset://sounds/collide.wav"
  421. Sound13.Volume = 1
  422. Script14.Name = "Rocket"
  423. Script14.Parent = LocalScript11
  424. Script14.Disabled = true
  425. table.insert(cors,sandbox(Script14,function()
  426. -----------------
  427. --| Constants |--
  428. -----------------
  429.  
  430. local BLAST_RADIUS = 8 -- Blast radius of the explosion
  431. local BLAST_DAMAGE = 60 -- Amount of damage done to players
  432. local BLAST_FORCE = 1000 -- Amount of force applied to parts
  433.  
  434. local IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these
  435. --NOTE: Keys must be lowercase, values must evaluate to true
  436.  
  437. -----------------
  438. --| Variables |--
  439. -----------------
  440.  
  441. local DebrisService = Game:GetService('Debris')
  442. local PlayersService = Game:GetService('Players')
  443.  
  444. local Rocket = script.Parent
  445.  
  446. local CreatorTag = Rocket:WaitForChild('creator')
  447. local SwooshSound = Rocket:WaitForChild('Swoosh')
  448.  
  449. -----------------
  450. --| Functions |--
  451. -----------------
  452.  
  453. -- Removes any old creator tags and applies a new one to the target
  454. local function ApplyTags(target)
  455. while target:FindFirstChild('creator') do
  456. target.creator:Destroy()
  457. end
  458.  
  459. local creatorTagClone = CreatorTag:Clone()
  460. DebrisService:AddItem(creatorTagClone, 1.5)
  461. creatorTagClone.Parent = target
  462. end
  463.  
  464. -- Returns the ancestor that contains a Humanoid, if it exists
  465. local function FindCharacterAncestor(subject)
  466. if subject and subject ~= Workspace then
  467. local humanoid = subject:FindFirstChild('Humanoid')
  468. if humanoid then
  469. return subject, humanoid
  470. else
  471. return FindCharacterAncestor(subject.Parent)
  472. end
  473. end
  474. return nil
  475. end
  476.  
  477. -- Customized explosive effect that doesn't affect teammates and only breaks joints on dead parts
  478. local function OnExplosionHit(hitPart, hitDistance, blastCenter)
  479. if hitPart and hitDistance then
  480. local character, humanoid = FindCharacterAncestor(hitPart.Parent)
  481.  
  482. if character then
  483. local myPlayer = CreatorTag.Value
  484. if myPlayer and not myPlayer.Neutral then -- Ignore friendlies caught in the blast
  485. local player = PlayersService:GetPlayerFromCharacter(character)
  486. if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
  487. return
  488. end
  489. end
  490. end
  491.  
  492. if humanoid and humanoid.Health > 0 then -- Humanoids are tagged and damaged
  493. if hitPart.Name == 'Torso' then
  494. ApplyTags(humanoid)
  495. humanoid:TakeDamage(BLAST_DAMAGE)
  496. end
  497. else -- Loose parts and dead parts are blasted
  498. if hitPart.Name ~= 'Handle' then
  499. hitPart:BreakJoints()
  500. local blastForce = Instance.new('BodyForce', hitPart) --NOTE: We will multiply by mass so bigger parts get blasted more
  501. blastForce.force = (hitPart.Position - blastCenter).unit * BLAST_FORCE * hitPart:GetMass()
  502. DebrisService:AddItem(blastForce, 0.1)
  503. end
  504. end
  505. end
  506. end
  507.  
  508. local function OnTouched(otherPart)
  509. if Rocket and otherPart then
  510. -- Fly through anything in the ignore list
  511. if IGNORE_LIST[string.lower(otherPart.Name)] then
  512. return
  513. end
  514.  
  515. local myPlayer = CreatorTag.Value
  516. if myPlayer then
  517. -- Fly through the creator
  518. if myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
  519. return
  520. end
  521.  
  522. -- Fly through friendlies
  523. if not myPlayer.Neutral then
  524. local character = FindCharacterAncestor(otherPart.Parent)
  525. local player = PlayersService:GetPlayerFromCharacter(character)
  526. if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
  527. return
  528. end
  529. end
  530. end
  531.  
  532. -- Fly through terrain water
  533. if otherPart == Workspace.Terrain then
  534. --NOTE: If the rocket is large, then the simplifications made here will cause it to fly through terrain in some cases
  535. local frontOfRocket = Rocket.Position + (Rocket.CFrame.lookVector * (Rocket.Size.Z / 2))
  536. local cellLocation = Workspace.Terrain:WorldToCellPreferSolid(frontOfRocket)
  537. local cellMaterial = Workspace.Terrain:GetCell(cellLocation.X, cellLocation.Y, cellLocation.Z)
  538. if cellMaterial == Enum.CellMaterial.Water or cellMaterial == Enum.CellMaterial.Empty then
  539. return
  540. end
  541. end
  542.  
  543. -- Create the explosion
  544. local explosion = Instance.new('Explosion')
  545. explosion.BlastPressure = 0 -- Completely safe explosion
  546. explosion.BlastRadius = BLAST_RADIUS
  547. explosion.ExplosionType = Enum.ExplosionType.NoCraters
  548. explosion.Position = Rocket.Position
  549. explosion.Parent = Workspace
  550.  
  551. -- Connect custom logic for the explosion
  552. explosion.Hit:connect(function(hitPart, hitDistance) OnExplosionHit(hitPart, hitDistance, explosion.Position) end)
  553.  
  554. -- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
  555. script.Parent = explosion
  556. CreatorTag.Parent = script
  557. Rocket:Destroy()
  558. end
  559. end
  560.  
  561. --------------------
  562. --| Script Logic |--
  563. --------------------
  564.  
  565. SwooshSound:Play()
  566.  
  567. Rocket.Touched:connect(OnTouched)
  568.  
  569. end))
  570. LocalScript15.Name = "MouseIcon"
  571. LocalScript15.Parent = Tool8
  572. table.insert(cors,sandbox(LocalScript15,function()
  573. local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
  574. local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
  575.  
  576. local Tool = script.Parent
  577.  
  578. local Mouse = nil
  579.  
  580. local function UpdateIcon()
  581. if Mouse then
  582. Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
  583. end
  584. end
  585.  
  586. local function OnEquipped(mouse)
  587. Mouse = mouse
  588. UpdateIcon()
  589. end
  590.  
  591. local function OnChanged(property)
  592. if property == 'Enabled' then
  593. UpdateIcon()
  594. end
  595. end
  596.  
  597. Tool.Equipped:connect(OnEquipped)
  598. Tool.Changed:connect(OnChanged)
  599.  
  600. end))
  601. Tool16.Name = "Trowl"
  602. Tool16.Parent = mas
  603. Tool16.GripPos = Vector3.new(0, -1.29999995, 0)
  604. Script17.Name = "WallMaker"
  605. Script17.Parent = Tool16
  606. table.insert(cors,sandbox(Script17,function()
  607. num = {12,43,21,54,34,100,36,78,99}
  608. number = num[math.random(1,#num)]
  609. num2 = {43,67,89,12,89,34}
  610. numbe2r = num2[math.random(1,#num2)]
  611. range = {3,5,8,9,6,10,15,11,12}
  612. rangechooser = range[math.random(1,#range)]
  613.  
  614.  
  615.  
  616.  
  617. local wallHeight = numbe2r
  618.  
  619. local wallWidth = number
  620.  
  621. local Tool = script.Parent
  622. random = {"Neon","Granite","Plastic","Cobblestone","Marble","Glass"}
  623. randomizer = random[math.random(1,#random)]
  624.  
  625. -- places a brick at pos and returns the position of the brick's opposite corner
  626. function placeBrick(cf, pos, color,material)
  627. local brick = Instance.new("Part")
  628. brick.BrickColor = BrickColor.Random()
  629. brick.Material = randomizer
  630. brick.Transparency = 0.7
  631. brick.CFrame = cf * CFrame.new(pos + brick.Size / 2)
  632. Script18:Clone().Parent = brick -- attach cleanup script to this brick
  633. brick.Parent = game.Workspace
  634. brick:MakeJoints()
  635.  
  636. light = Instance.new("PointLight")
  637. light.Brightness = 0.3
  638. light.Range = rangechooser
  639. light.Color = brick.Color
  640. light.Parent = brick
  641. light.Shadows = true
  642.  
  643. sound = Instance.new("Sound")
  644. sound.Volume = 10
  645. sound.Pitch = 1
  646. sound.SoundId = "rbxassetid://1210272936"
  647. sound.Looped = false
  648. sound.Parent = brick
  649. sound:Play()
  650.  
  651. return brick, pos + brick.Size
  652. end
  653.  
  654. function buildWall(cf)
  655.  
  656. local color = BrickColor.Random()
  657. local material = randomizer
  658. local bricks = {}
  659.  
  660. assert(wallWidth>0)
  661. local y = 0
  662. while y < wallHeight do
  663. local p
  664. local x = -wallWidth/2
  665. while x < wallWidth/2 do
  666. local brick
  667. brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
  668. brick.Material = material
  669. x = p.x
  670. table.insert(bricks, brick)
  671. wait()
  672. end
  673. y = p.y
  674. end
  675.  
  676. return bricks
  677.  
  678. end
  679.  
  680.  
  681. function snap(v)
  682. if math.abs(v.x)>math.abs(v.z) then
  683. if v.x>0 then
  684. return Vector3.new(1,0,0)
  685. else
  686. return Vector3.new(-1,0,0)
  687. end
  688. else
  689. if v.z>0 then
  690. return Vector3.new(0,0,1)
  691. else
  692. return Vector3.new(0,0,-1)
  693. end
  694. end
  695. end
  696.  
  697.  
  698. Tool.Enabled = true
  699. function onActivated()
  700.  
  701. if not Tool.Enabled then
  702. return
  703. end
  704.  
  705. Tool.Enabled = false
  706.  
  707. local character = Tool.Parent;
  708. local humanoid = character.Humanoid
  709. if humanoid == nil then
  710. print("Humanoid not found")
  711. return
  712. end
  713.  
  714. local targetPos = humanoid.TargetPoint
  715. local lookAt = snap( (targetPos - character.Head.Position).unit )
  716. local cf = CFrame.new(targetPos, targetPos + lookAt)
  717.  
  718. Tool.Handle.BuildSound:play()
  719.  
  720. buildWall(cf)
  721.  
  722. wait()
  723.  
  724. Tool.Enabled = true
  725. end
  726.  
  727. script.Parent.Activated:connect(onActivated)
  728.  
  729.  
  730. end))
  731. Script18.Name = "BrickCleanup"
  732. Script18.Parent = Tool16
  733. Script18.Disabled = true
  734. table.insert(cors,sandbox(Script18,function()
  735. -- this script removes its parent from the workspace after 24 seconds
  736.  
  737.  
  738.  
  739. end))
  740. Part19.Name = "Handle"
  741. Part19.Parent = Tool16
  742. Part19.BrickColor = BrickColor.new("Brick yellow")
  743. Part19.Rotation = Vector3.new(-90, 0, 0)
  744. Part19.FormFactor = Enum.FormFactor.Plate
  745. Part19.Size = Vector3.new(1, 4.4000001, 1)
  746. Part19.CFrame = CFrame.new(11.04, 0.500001013, -88.2899933, 1, -0, 0, 0, -0, 1, 0, -1, 0)
  747. Part19.BackSurface = Enum.SurfaceType.Weld
  748. Part19.FrontSurface = Enum.SurfaceType.Weld
  749. Part19.Color = Color3.new(0.843137, 0.772549, 0.603922)
  750. Part19.Position = Vector3.new(11.04, 0.500001013, -88.2899933)
  751. Part19.Orientation = Vector3.new(-90, 0, 0)
  752. Part19.Color = Color3.new(0.843137, 0.772549, 0.603922)
  753. SpecialMesh20.Parent = Part19
  754. SpecialMesh20.MeshId = "rbxasset://fonts/trowel.mesh"
  755. SpecialMesh20.TextureId = "rbxasset://textures/TrowelTexture.png"
  756. SpecialMesh20.MeshType = Enum.MeshType.FileMesh
  757. Sound21.Name = "BuildSound"
  758. Sound21.Parent = Part19
  759. Sound21.SoundId = "rbxasset://sounds//bass.wav"
  760. Sound21.Volume = 1
  761. LocalScript22.Name = "MouseIcon"
  762. LocalScript22.Parent = Tool16
  763. table.insert(cors,sandbox(LocalScript22,function()
  764. local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
  765. local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
  766.  
  767. local Tool = script.Parent
  768.  
  769. local Mouse = nil
  770.  
  771. local function UpdateIcon()
  772. if Mouse then
  773. Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
  774. end
  775. end
  776.  
  777. local function OnEquipped(mouse)
  778. Mouse = mouse
  779. UpdateIcon()
  780. end
  781.  
  782. local function OnChanged(property)
  783. if property == 'Enabled' then
  784. UpdateIcon()
  785. end
  786. end
  787.  
  788. Tool.Equipped:connect(OnEquipped)
  789. Tool.Changed:connect(OnChanged)
  790.  
  791. end))
  792. for i,v in pairs(mas:GetChildren()) do
  793. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  794. pcall(function() v:MakeJoints() end)
  795. end
  796. mas:Destroy()
  797. for i,v in pairs(cors) do
  798. spawn(function()
  799. pcall(v)
  800. end)
  801. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement