xDavid673x

BTool

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