Advertisement
SetsunaElysia

Bridge Tool

Jan 17th, 2017
1,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. --[[
  2. Script shared by eletronix ]]
  3.  
  4. me = game.Players.LocalPlayer
  5.  
  6. if script.Parent.className ~= "HopperBin" then
  7. h = Instance.new("HopperBin")
  8. h.Parent = me.Backpack
  9. h.Name = "Bridge Tool"
  10. script.Parent = h
  11. end
  12.  
  13. sp = script.Parent
  14.  
  15. bridges = {}
  16.  
  17.  
  18. hold = false
  19. using = false
  20. holdkey = false
  21.  
  22. polesize = 5
  23.  
  24. function selected(mouse, key)
  25. mouse.Button1Down:connect(function()
  26. if mouse.Target == nil then return end
  27. if using == true then return end
  28. using = true
  29. hold = true
  30. pos = mouse.Hit.p
  31. p = Instance.new("Part")
  32. p.Parent = workspace
  33. p.formFactor = 0
  34. p.Size = Vector3.new(50,1,1)
  35. p.Anchored = true
  36. p.Transparency = 0.6
  37. p.TopSurface = 0
  38. p.BrickColor = BrickColor.new("Really black")
  39. p.BottomSurface = 0
  40. p.CFrame = CFrame.new(pos)
  41. mes = Instance.new("SpecialMesh")
  42. mes.Parent = p
  43. mes.MeshType = "Brick"
  44. mes.Scale = Vector3.new(1,1,1)
  45. table.insert(bridges, p)
  46. mouse.Move:connect(function()
  47. if mouse.Target == nil then return end
  48. if hold == true then
  49. local dist = (p.Position - mouse.Hit.p).magnitude
  50. p.CFrame = CFrame.new((mouse.Hit.p + pos)/2, pos)
  51. mes.Scale = Vector3.new(1,1,dist*2)
  52. end
  53. end)
  54. end)
  55. mouse.Button1Up:connect(function()
  56. hold = false
  57. local duh = p.CFrame
  58. p.Size = Vector3.new(50,1,mes.Scale.Z)
  59. p.CFrame = duh
  60. mes:remove()
  61. for i=1, 5 do
  62. wait()
  63. p.Transparency = p.Transparency - 0.12
  64. end
  65. p.Material = "Wood"
  66. using = false
  67. end)
  68. mouse.KeyDown:connect(function(key)
  69. key = key:lower()
  70. if (key == "r") then
  71. for i=1, #bridges do
  72. bridges[i]:remove()
  73. end
  74. elseif (key == "q") then
  75. polesize = polesize - 1
  76. local ms = Instance.new("Message")
  77. ms.Parent = me
  78. ms.Text = "Pole size decreased to "..polesize
  79. wait(0.4)
  80. ms:remove()
  81. elseif (key == "e") then
  82. polesize = polesize + 1
  83. local ms = Instance.new("Message")
  84. ms.Parent = me
  85. ms.Text = "Pole size increased to "..polesize
  86. wait(0.4)
  87. ms:remove()
  88. elseif (key == "f") then
  89. if mouse.Target == nil then return end
  90. if using == true then return end
  91. using = true
  92. holdkey = true
  93. po = Instance.new("Part")
  94. po.Parent = workspace
  95. po.formFactor = 0
  96. po.Size = Vector3.new(1,1,1)
  97. po.Anchored = true
  98. po.Transparency = 0.5
  99. po.TopSurface = 0
  100. po.BrickColor = BrickColor.new("Really black")
  101. po.BottomSurface = 0
  102. mesh = Instance.new("SpecialMesh")
  103. mesh.Parent = po
  104. mesh.Scale = Vector3.new(1,polesize,1)
  105. po.CFrame = CFrame.new(mouse.Hit.p.X, mouse.Hit.p.Y + mesh.Scale.Y/2, mouse.Hit.p.Z)
  106. table.insert(bridges,po)
  107. end
  108. end)
  109. mouse.KeyUp:connect(function(key)
  110. key = key:lower()
  111. if (key == "f") then
  112. holdkey = false
  113. for i=1, 5 do
  114. wait()
  115. po.Transparency = po.Transparency - 0.1
  116. end
  117. local posi = po.CFrame
  118. po.Material = "Wood"
  119. po.Size = mesh.Scale
  120. mesh:remove()
  121. po.CFrame = posi
  122. using = false
  123. end
  124. end)
  125. end
  126.  
  127. function deselected()
  128. end
  129.  
  130. sp.Selected:connect(selected)
  131. sp.Deselected:connect(deselected)
  132.  
  133. --mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement