Advertisement
Dodikman

PJJ TOOLs

Jul 17th, 2019
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.71 KB | None | 0 0
  1. function decorateButton(button, color, s1, s2)
  2.     local actualColor = button.BackgroundColor3
  3.     button.MouseButton1Click:Connect(function()
  4.         s1:Play()
  5.     end)
  6.     button.MouseEnter:Connect(function()
  7.         s2:Play()
  8.         button.BackgroundColor3 = color
  9.     end)
  10.     button.MouseLeave:Connect(function()
  11.         button.BackgroundColor3 = actualColor
  12.     end)
  13. end
  14. local plr = game.Players.LocalPlayer
  15. local gui = Instance.new('ScreenGui')
  16. gui.Parent = plr.PlayerGui
  17. gui.ResetOnSpawn = false
  18. local frame = Instance.new('Frame')
  19. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  20. frame.BackgroundTransparency = 0.5
  21. frame.Parent = gui
  22. local button1 = Instance.new('TextButton')
  23. button1.BackgroundColor3 = Color3.new(0, 0, 0)
  24. button1.BackgroundTransparency = 0.5
  25. button1.Font = Enum.Font.Gotham
  26. button1.Parent = gui
  27. button1.Text = 'Tools'
  28. button1.TextColor3 = Color3.new(0, 20, 20)
  29. button1.TextScaled = true
  30. local sound = Instance.new('Sound')
  31. sound.Parent = game.Workspace
  32. sound.SoundId = 'rbxassetid://537744814'
  33. sound.Volume = 2
  34. local sound2 = sound:Clone()
  35. sound2.Parent = game.Workspace
  36. sound2.SoundId = 'rbxassetid://408524543'
  37. decorateButton(button1, Color3.new(0, 20, 20), sound, sound2)
  38. local opened = true
  39. button1.MouseButton1Click:Connect(function()
  40.     if opened == true then
  41.         frame:TweenPosition(UDim2.new(0, 0, 1, 0))
  42.         button1:TweenPosition(UDim2.new(0, 0, 0.95, 0))
  43.         opened = false
  44.     else
  45.         frame:TweenPosition(UDim2.new(0, 0, 0.5, 0))
  46.         button1:TweenPosition(UDim2.new(0, 0, 0.45, 0))
  47.         opened = true
  48.     end
  49. end)
  50. frame:TweenSize(UDim2.new(0.125, 0, 0.5, 0))
  51. frame:TweenPosition(UDim2.new(0, 0, 0.5, 0))
  52. button1:TweenSize(UDim2.new(0.125, 0, 0.05, 0))
  53. button1:TweenPosition(UDim2.new(0, 0, 0.45, 0))
  54. local buttons = {}
  55. local order = {}
  56. local nextPosition = nil
  57. function removeButton(object)
  58.     local button = buttons[object]
  59.     table.insert(order, button.Position)
  60.     button.Text = ''
  61.     button:TweenSize(UDim2.new(0, 0, 0, 0))
  62.     wait(1)
  63.     button:Destroy()
  64.     button = nil
  65. end
  66. game.Workspace.ChildRemoved:Connect(function(child)
  67.     if buttons[child] ~= nil then
  68.         removeButton(child)
  69.     end
  70. end)
  71. function addButton(object)
  72.     wait(0.15)
  73.     local button = Instance.new('TextButton')
  74.     button.BackgroundColor3 = Color3.new(0, 0, 0)
  75.     button.BackgroundTransparency = 0.75
  76.     button.Parent = frame
  77.     button.Position = UDim2.new(0, 0, -0.1, 0)
  78.     button.Text = object.Name
  79.     button.TextColor3 = Color3.new(0, 20, 20)
  80.     button.TextScaled = true
  81.     decorateButton(button, Color3.new(0, 20, 20), sound, sound2)
  82.     button.MouseButton1Click:Connect(function()
  83.         if game.Workspace:FindFirstChild(plr.Name) then
  84.             local char = plr.Character
  85.             local lastPos = char.HumanoidRootPart.Position
  86.             if object.ClassName == 'Tool' then
  87.                 char:MoveTo(object.Handle.Position)
  88.             else
  89.                 char:MoveTo(object.Position)
  90.             end
  91.             if gui:FindFirstChild('tp') then
  92.                 gui:FindFirstChild('tp'):Remove()
  93.             end
  94.             local tp = button:Clone()
  95.             tp.BackgroundColor3 = Color3.new(0, 0, 0, 0)
  96.             tp.BackgroundTransparency = 0.5
  97.             tp.Name = 'tp'
  98.             tp.Parent = gui
  99.             tp.Position = UDim2.new(0, 0, -0.1, 0)
  100.             tp.Size = UDim2.new(0, 0, 0, 0)
  101.             tp.Text = 'Teleport back?'
  102.             tp:TweenPosition(UDim2.new(0.13, 0, 0.95, 0))
  103.             tp:TweenSize(UDim2.new(0.125, 0, 0.05, 0))
  104.             decorateButton(tp, Color3.new(0, 20, 20), sound, sound2)
  105.             local tped = false
  106.             tp.MouseButton1Click:Connect(function()
  107.                 tped = true
  108.                 char:MoveTo(lastPos)
  109.                 tp.Name = ''
  110.                 tp.Text = ''
  111.                 tp:TweenSize(UDim2.new(0, 0, 0, 0))
  112.                 wait(1)
  113.                 tp:Remove()
  114.             end)
  115.             for i = 5, 1, -1 do
  116.                 tp.Text = 'Teleport back? ' .. i
  117.                 wait(1)
  118.             end
  119.             if tped == false then
  120.                 tp.Name = ''
  121.                 tp.Text = ''
  122.                 tp:TweenSize(UDim2.new(0, 0, 0, 0))
  123.                 wait(1)
  124.                 tp:Remove()
  125.             end
  126.         end
  127.     end)
  128.     if #order >= 1 then
  129.         button:TweenPosition(order[#order])
  130.         order[#order] = nil
  131.     else
  132.         if nextPosition then
  133.             button:TweenPosition(nextPosition)
  134.             nextPosition = nextPosition + UDim2.new(0, 0, 0.05, 0)
  135.         else
  136.             nextPosition = UDim2.new(0, 0, 0.05, 0)
  137.             button:TweenPosition(UDim2.new(0, 0, 0, 0))
  138.         end
  139.     end
  140.     button:TweenSize(UDim2.new(1, 0, 0.05, 0))
  141.     buttons[object] = button
  142. end
  143. local black = {
  144.     ['Shop'] = 1,
  145.     ['crab'] = 1,
  146.     ['bigmeter'] = 1
  147.     }
  148. function valid(object)
  149.     if black[object.Name] ~= nil then
  150.         return false
  151.     end
  152.     if object.ClassName == 'Tool' and object:FindFirstChild('Handle') then
  153.         return true
  154.     elseif object.ClassName == 'Part' and object:FindFirstChild('ClickDetector') then
  155.        
  156.         return true
  157.     end
  158.     return false
  159. end
  160. for k, v in pairs(game.Workspace:GetChildren()) do
  161.     if valid(v) then
  162.         addButton(v)
  163.     end
  164. end
  165. game.Workspace.ChildAdded:Connect(function(child)
  166.     spawn(function()
  167.         wait(1)
  168.         if valid(child) then
  169.             addButton(child)
  170.         end
  171.     end)
  172. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement