Advertisement
rustman

Roblox script part finder

Apr 13th, 2023
302
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.55 KB | None | 1 0
  1. -- This script is for people who are creating scripts. It identifies the workspace relationship between objects that you hover over with your mouse. It also has options to hide the GUI, highlight the part so it can be seen through walls, and freeze the GUI so you can copy and paste the path of the object
  2.  
  3. -- script starts here
  4.  
  5. local Players = game:GetService("Players")
  6. local UserInputService = game:GetService("UserInputService")
  7. local TweenService = game:GetService("TweenService")
  8. local RunService = game:GetService("RunService")
  9.  
  10. local player = Players.LocalPlayer
  11. local mouse = player:GetMouse()
  12.  
  13. local gui = Instance.new("ScreenGui")
  14. gui.Parent = player.PlayerGui
  15. gui.Name = "DraggableGUI"
  16.  
  17. local frameOuter = Instance.new("Frame")
  18. frameOuter.Parent = gui
  19. frameOuter.Size = UDim2.new(0.3, 20, 0.3, 20)
  20. frameOuter.Position = UDim2.new(0.35, -10, 0.35, -10)
  21. frameOuter.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
  22. frameOuter.BorderSizePixel = 0
  23. frameOuter.Active = true
  24.  
  25. local frame = Instance.new("Frame")
  26. frame.Parent = frameOuter
  27. frame.Size = UDim2.new(1, -20, 1, -20)
  28. frame.Position = UDim2.new(0, 10, 0, 10)
  29. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  30. frame.BackgroundTransparency = 0.5
  31. frame.BorderSizePixel = 0
  32. frame.ClipsDescendants = true
  33.  
  34. local objectInfo = Instance.new("TextBox")
  35. objectInfo.Parent = frame
  36. objectInfo.Size = UDim2.new(1, 0, 1, 0)
  37. objectInfo.BackgroundTransparency = 1
  38. objectInfo.TextColor3 = Color3.new(1, 1, 1)
  39. objectInfo.TextScaled = true
  40. objectInfo.TextWrapped = true
  41. objectInfo.ClearTextOnFocus = false
  42. objectInfo.Text = ""
  43.  
  44. local espObjectButton = Instance.new("TextButton")
  45. espObjectButton.Parent = frameOuter
  46. espObjectButton.Size = UDim2.new(1, 0, 0, 30)
  47. espObjectButton.Position = UDim2.new(0, 0, 1, -30)
  48. espObjectButton.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
  49. espObjectButton.BorderSizePixel = 0
  50. espObjectButton.Text = "ESP Object"
  51. espObjectButton.TextColor3 = Color3.new(1, 1, 1)
  52. espObjectButton.TextScaled = true
  53.  
  54. local isDragging = false
  55. local dragInput, dragStart, frameStartPosition
  56.  
  57. local function update(input)
  58.     local delta = input.Position - dragStart
  59.     frameOuter.Position = UDim2.new(frameStartPosition.X.Scale, frameStartPosition.X.Offset + delta.X, frameStartPosition.Y.Scale, frameStartPosition.Y.Offset + delta.Y)
  60. end
  61.  
  62. frameOuter.InputBegan:Connect(function(input)
  63.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  64.         isDragging = true
  65.         dragStart = input.Position
  66.         frameStartPosition = frameOuter.Position
  67.  
  68.         input.Changed:Connect(function()
  69.             if input.UserInputState == Enum.UserInputState.End then
  70.                 isDragging = false
  71.             end
  72.         end)
  73.     end
  74. end)
  75.  
  76. frameOuter.InputChanged:Connect(function(input)
  77.     if input.UserInputType == Enum.UserInputType.MouseMovement then
  78.         dragInput = input
  79.     end
  80. end)
  81.  
  82. UserInputService.InputChanged:Connect(function(input)
  83.     if input == dragInput and isDragging then
  84.         update(input)
  85.     end
  86. end)
  87.  
  88. local frozen = false
  89. local frozenTarget = nil
  90.  
  91. local function updateObjectInfo(target)
  92.    
  93.         if not frozen then
  94.         if target and target.GetFullName and typeof(target.GetFullName) == "function" then
  95.             local path = target:GetFullName()
  96.             objectInfo.Text = "Object: " .. path
  97.             frozenTarget = target
  98.         else
  99.             objectInfo.Text = "No object under cursor."
  100.             frozenTarget = nil
  101.         end
  102.     end
  103. end
  104.  
  105. local function onMouseMove()
  106.     local target = mouse.Target
  107.     updateObjectInfo(target)
  108. end
  109.  
  110. mouse.Move:Connect(onMouseMove)
  111.  
  112. local function onInputChanged(inputObject)
  113.     if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
  114.         onMouseMove()
  115.     end
  116. end
  117.  
  118. UserInputService.InputChanged:Connect(onInputChanged)
  119.  
  120. objectInfo.FocusLost:Connect(function()
  121.     objectInfo.Text = objectInfo.Text
  122. end)
  123.  
  124. local function onInputBegan(inputObject, gameProcessed)
  125.     if inputObject.KeyCode == Enum.KeyCode.T and not gameProcessed then
  126.         frozen = not frozen
  127.     elseif inputObject.KeyCode == Enum.KeyCode.Y and not gameProcessed then
  128.         frameOuter.Visible = not frameOuter.Visible
  129.     end
  130. end
  131.  
  132. UserInputService.InputBegan:Connect(onInputBegan)
  133.  
  134. local function createESP(target)
  135.     local box = Instance.new("BoxHandleAdornment")
  136.     box.Name = "ESPBox"
  137.     box.Parent = workspace
  138.     box.Adornee = target
  139.     box.AlwaysOnTop = true
  140.     box.Size = target.Size
  141.     box.Color3 = Color3.new(1, 0, 0)
  142.     box.Transparency = 0.5
  143.     box.ZIndex = 10
  144.     return box
  145. end
  146.  
  147. local function removeESP()
  148.     for _, child in ipairs(workspace:GetChildren()) do
  149.         if child.Name == "ESPBox" then
  150.             child:Destroy()
  151.         end
  152.     end
  153. end
  154.  
  155. local currentESP
  156.  
  157. espObjectButton.MouseButton1Click:Connect(function()
  158.     if currentESP then
  159.         currentESP:Destroy()
  160.         currentESP = nil
  161.     end
  162.  
  163.     if frozenTarget then
  164.         currentESP = createESP(frozenTarget)
  165.     end
  166. end)
  167.  
  168. RunService.RenderStepped:Connect(function()
  169.     if currentESP then
  170.         currentESP.Size = currentESP.Adornee.Size
  171.     end
  172. end)
  173.  
  174. local function showNotification()
  175.     local notification = Instance.new("TextLabel")
  176.     notification.Parent = gui
  177.     notification.Size = UDim2.new(0.3, 0, 0.05, 0)
  178.     notification.Position = UDim2.new(1, 0, 0.9, 0)
  179.     notification.BackgroundTransparency = 0.5
  180.     notification.BackgroundColor3 = Color3.new(0, 0, 0)
  181.     notification.BorderSizePixel = 0
  182.     notification.TextScaled = true
  183.     notification.TextWrapped = true
  184.     notification.TextColor3 = Color3.new(1, 1, 1)
  185.     notification.Text = "Press 'T' to freeze and unfreeze the GUI or press 'Y' to hide the GUI"
  186.  
  187.     local tweenIn = TweenService:Create(notification, TweenInfo.new(1), {Position = UDim2.new(0.65, 0, 0.9, 0)})
  188.     local tweenOut = TweenService:Create(notification, TweenInfo.new(1), {Position = UDim2.new(1, 0, 0.9, 0)})
  189.  
  190.     tweenIn:Play()
  191.     wait(3)
  192.     tweenOut:Play()
  193.  
  194.     tweenOut.Completed:Wait()
  195.     notification:Destroy()
  196. end
  197.  
  198. showNotification()
  199.  
  200. local function closeGui()
  201.     gui:Destroy()
  202. end
  203.  
  204. -- Create the "X" button
  205. local closeButton = Instance.new("TextButton")
  206. closeButton.Parent = frameOuter
  207. closeButton.Size = UDim2.new(0, 20, 0, 20)
  208. closeButton.Position = UDim2.new(1, -20, 0, 0)
  209. closeButton.BackgroundColor3 = Color3.new(1, 0, 0)
  210. closeButton.BorderSizePixel = 0
  211. closeButton.Text = "X"
  212. closeButton.TextColor3 = Color3.new(1, 1, 1)
  213. closeButton.TextScaled = true
  214.  
  215. closeButton.MouseButton1Click:Connect(closeGui)
  216.  
  217.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement