SHARE
TWEET

Untitled

Vzurxy Nov 11th, 2018 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. me = game.Players.LocalPlayer
  2. h = Instance.new("HopperBin")
  3. h.Parent = me.Backpack
  4. h.Name = "Bridge Tool"
  5. bridges = {}
  6. hold = false
  7. using = false
  8. holdkey = false
  9. polesize = 5
  10. function selected(mouse, key)
  11.     mouse.Button1Down:connect(function()
  12.         if mouse.Target == nil then return end
  13.         if using == true then return end
  14.         using = true
  15.         hold = true
  16.         pos = mouse.Hit.p
  17.         p = Instance.new("Part")
  18.         p.Parent = workspace
  19.         p.formFactor = 0
  20.         p.Size = Vector3.new(5,1,1)
  21.         p.Anchored = true
  22.         p.Transparency = 0.6
  23.         p.TopSurface = 0
  24.         p.BrickColor = BrickColor.new("Brown")
  25.         p.BottomSurface = 0
  26.         p.CFrame = CFrame.new(pos)
  27.         mes = Instance.new("SpecialMesh")
  28.         mes.Parent = p
  29.         mes.MeshType = "Brick"
  30.         mes.Scale = Vector3.new(1,1,1)
  31.         table.insert(bridges, p)
  32.         mouse.Move:connect(function()
  33.             if mouse.Target == nil then return end
  34.             if hold == true then
  35.                 local dist = (p.Position - mouse.Hit.p).magnitude
  36.                 p.CFrame = CFrame.new((mouse.Hit.p + pos)/2, pos)
  37.                 mes.Scale = Vector3.new(1,1,dist*2)
  38.             end
  39.         end)
  40.     end)
  41.     mouse.Button1Up:connect(function()
  42.         hold = false
  43.         local duh = p.CFrame
  44.         p.Size = Vector3.new(5,1,mes.Scale.Z)
  45.         p.CFrame = duh
  46.         mes:remove()
  47.         for i=1, 5 do
  48.             wait()
  49.             p.Transparency = p.Transparency - 0.12
  50.         end
  51.         p.Material = "Wood"
  52.         using = false
  53.     end)
  54.     mouse.KeyDown:connect(function(key)
  55.         key = key:lower()
  56.         if (key == "r") then
  57.             for i=1, #bridges do
  58.                 bridges[i]:remove()
  59.             end
  60.         elseif (key == "q") then
  61.             polesize = polesize - 1
  62.             local ms = Instance.new("Message")
  63.             ms.Parent = me
  64.             ms.Text = "Pole size decreased to "..polesize
  65.             wait(0.4)
  66.             ms:remove()
  67.         elseif (key == "e") then
  68.             polesize = polesize + 1
  69.             local ms = Instance.new("Message")
  70.             ms.Parent = me
  71.             ms.Text = "Pole size increased to "..polesize
  72.             wait(0.4)
  73.             ms:remove()
  74.         elseif (key == "f") then
  75.             if mouse.Target == nil then return end
  76.             if using == true then return end
  77.             using = true
  78.             holdkey = true
  79.             po = Instance.new("Part")
  80.             po.Parent = workspace
  81.             po.formFactor = 0
  82.             po.Size = Vector3.new(1,1,1)
  83.             po.Anchored = true
  84.             po.Transparency = 0.5
  85.             po.TopSurface = 0
  86.             po.BrickColor = BrickColor.new("Brown")
  87.             po.BottomSurface = 0
  88.             mesh = Instance.new("SpecialMesh")
  89.             mesh.Parent = po
  90.             mesh.Scale = Vector3.new(1,polesize,1)
  91.             po.CFrame = CFrame.new(mouse.Hit.p.X, mouse.Hit.p.Y + mesh.Scale.Y/2, mouse.Hit.p.Z)
  92.             table.insert(bridges,po)
  93.         end
  94.     end)
  95.     mouse.KeyUp:connect(function(key)
  96.         key = key:lower()
  97.         if (key == "f") then
  98.             holdkey = false
  99.             for i=1, 5 do
  100.                 wait()
  101.                 po.Transparency = po.Transparency - 0.1
  102.             end
  103.             local posi = po.CFrame
  104.             po.Material = "Wood"
  105.             po.Size = mesh.Scale
  106.             mesh:remove()
  107.             po.CFrame = posi
  108.             using = false
  109.         end
  110.     end)
  111. end
  112. function deselected()
  113. return
  114. end
  115. h.Selected:connect(selected)
  116. h.Deselected:connect(deselected)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top