Advertisement
Fauzan1GDR

Btools Lumber Tycoon 2

Mar 22nd, 2020
2,221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. script.Parent.MouseButton1Click:Connect(function()
  2. local LocalPlayer = game:GetService("Players").LocalPlayer
  3. local mouse = LocalPlayer:GetMouse()
  4. local movetool = Instance.new("Tool", LocalPlayer.Backpack)
  5. local deletetool = Instance.new("Tool", LocalPlayer.Backpack)
  6. local undotool = Instance.new("Tool", LocalPlayer.Backpack)
  7. local identifytool = Instance.new("Tool", LocalPlayer.Backpack)
  8. local movedetect = false
  9. local movingpart = nil
  10. local movetransparency = 0
  11. if editedparts == nil then
  12. editedparts = {}
  13. parentfix = {}
  14. positionfix = {}
  15. end
  16. deletetool.Name = "Delete"
  17. undotool.Name = "Undo"
  18. identifytool.Name = "Identify"
  19. movetool.Name = "Move"
  20. undotool.CanBeDropped = false
  21. deletetool.CanBeDropped = false
  22. identifytool.CanBeDropped = false
  23. movetool.CanBeDropped = false
  24. undotool.RequiresHandle = false
  25. deletetool.RequiresHandle = false
  26. identifytool.RequiresHandle = false
  27. movetool.RequiresHandle = false
  28. local function createnotification(title, text)
  29. game:GetService("StarterGui"):SetCore("SendNotification", {
  30. Title = title;
  31. Text = text;
  32. Duration = 1;
  33. })
  34. end
  35. deletetool.Activated:Connect(function()
  36. createnotification("Delete Tool", "You have deleted "..mouse.Target.Name)
  37. table.insert(editedparts, mouse.Target)
  38. table.insert(parentfix, mouse.Target.Parent)
  39. table.insert(positionfix, mouse.Target.CFrame)
  40. mouse.Target.Parent = nil
  41. end)
  42. undotool.Activated:Connect(function()
  43. createnotification("Undo Tool", "You have undone "..editedparts[#editedparts].Name)
  44. editedparts[#editedparts].Parent = parentfix[#parentfix]
  45. editedparts[#editedparts].CFrame = positionfix[#positionfix]
  46. table.remove(positionfix, #positionfix)
  47. table.remove(editedparts, #editedparts)
  48. table.remove(parentfix, #parentfix)
  49. end)
  50. identifytool.Activated:Connect(function()
  51. createnotification("Identify Tool", "Instance: "..mouse.Target.ClassName.."\nName: "..mouse.Target.Name)
  52. end)
  53. movetool.Activated:Connect(function()
  54. createnotification("Move Tool", "You are moving: "..mouse.Target.Name)
  55. movingpart = mouse.Target
  56. movedetect = true
  57. movingpart.CanCollide = false
  58. movetransparency = movingpart.Transparency
  59. movingpart.Transparency = 0.5
  60. mouse.TargetFilter = movingpart
  61. table.insert(editedparts, movingpart)
  62. table.insert(parentfix, movingpart.Parent)
  63. table.insert(positionfix, movingpart.CFrame)
  64. movingpart.Transparency = movingpart.Transparency / 2
  65. repeat
  66. mouse.Move:Wait()
  67. movingpart.CFrame = CFrame.new(mouse.Hit.p)
  68. until movedetect == false
  69. end)
  70. movetool.Deactivated:Connect(function()
  71. createnotification("Move Tool", "You have stopped moving: "..mouse.Target.Name)
  72. movingpart.CanCollide = true
  73. movedetect = false
  74. mouse.TargetFilter = nil
  75. movingpart.Transparency = movetransparenc
  76. end)
  77. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement