Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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
- -- script starts here
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local RunService = game:GetService("RunService")
- local player = Players.LocalPlayer
- local mouse = player:GetMouse()
- local gui = Instance.new("ScreenGui")
- gui.Parent = player.PlayerGui
- gui.Name = "DraggableGUI"
- local frameOuter = Instance.new("Frame")
- frameOuter.Parent = gui
- frameOuter.Size = UDim2.new(0.3, 20, 0.3, 20)
- frameOuter.Position = UDim2.new(0.35, -10, 0.35, -10)
- frameOuter.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
- frameOuter.BorderSizePixel = 0
- frameOuter.Active = true
- local frame = Instance.new("Frame")
- frame.Parent = frameOuter
- frame.Size = UDim2.new(1, -20, 1, -20)
- frame.Position = UDim2.new(0, 10, 0, 10)
- frame.BackgroundColor3 = Color3.new(0, 0, 0)
- frame.BackgroundTransparency = 0.5
- frame.BorderSizePixel = 0
- frame.ClipsDescendants = true
- local objectInfo = Instance.new("TextBox")
- objectInfo.Parent = frame
- objectInfo.Size = UDim2.new(1, 0, 1, 0)
- objectInfo.BackgroundTransparency = 1
- objectInfo.TextColor3 = Color3.new(1, 1, 1)
- objectInfo.TextScaled = true
- objectInfo.TextWrapped = true
- objectInfo.ClearTextOnFocus = false
- objectInfo.Text = ""
- local espObjectButton = Instance.new("TextButton")
- espObjectButton.Parent = frameOuter
- espObjectButton.Size = UDim2.new(1, 0, 0, 30)
- espObjectButton.Position = UDim2.new(0, 0, 1, -30)
- espObjectButton.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
- espObjectButton.BorderSizePixel = 0
- espObjectButton.Text = "ESP Object"
- espObjectButton.TextColor3 = Color3.new(1, 1, 1)
- espObjectButton.TextScaled = true
- local isDragging = false
- local dragInput, dragStart, frameStartPosition
- local function update(input)
- local delta = input.Position - dragStart
- frameOuter.Position = UDim2.new(frameStartPosition.X.Scale, frameStartPosition.X.Offset + delta.X, frameStartPosition.Y.Scale, frameStartPosition.Y.Offset + delta.Y)
- end
- frameOuter.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = true
- dragStart = input.Position
- frameStartPosition = frameOuter.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- isDragging = false
- end
- end)
- end
- end)
- frameOuter.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and isDragging then
- update(input)
- end
- end)
- local frozen = false
- local frozenTarget = nil
- local function updateObjectInfo(target)
- if not frozen then
- if target and target.GetFullName and typeof(target.GetFullName) == "function" then
- local path = target:GetFullName()
- objectInfo.Text = "Object: " .. path
- frozenTarget = target
- else
- objectInfo.Text = "No object under cursor."
- frozenTarget = nil
- end
- end
- end
- local function onMouseMove()
- local target = mouse.Target
- updateObjectInfo(target)
- end
- mouse.Move:Connect(onMouseMove)
- local function onInputChanged(inputObject)
- if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
- onMouseMove()
- end
- end
- UserInputService.InputChanged:Connect(onInputChanged)
- objectInfo.FocusLost:Connect(function()
- objectInfo.Text = objectInfo.Text
- end)
- local function onInputBegan(inputObject, gameProcessed)
- if inputObject.KeyCode == Enum.KeyCode.T and not gameProcessed then
- frozen = not frozen
- elseif inputObject.KeyCode == Enum.KeyCode.Y and not gameProcessed then
- frameOuter.Visible = not frameOuter.Visible
- end
- end
- UserInputService.InputBegan:Connect(onInputBegan)
- local function createESP(target)
- local box = Instance.new("BoxHandleAdornment")
- box.Name = "ESPBox"
- box.Parent = workspace
- box.Adornee = target
- box.AlwaysOnTop = true
- box.Size = target.Size
- box.Color3 = Color3.new(1, 0, 0)
- box.Transparency = 0.5
- box.ZIndex = 10
- return box
- end
- local function removeESP()
- for _, child in ipairs(workspace:GetChildren()) do
- if child.Name == "ESPBox" then
- child:Destroy()
- end
- end
- end
- local currentESP
- espObjectButton.MouseButton1Click:Connect(function()
- if currentESP then
- currentESP:Destroy()
- currentESP = nil
- end
- if frozenTarget then
- currentESP = createESP(frozenTarget)
- end
- end)
- RunService.RenderStepped:Connect(function()
- if currentESP then
- currentESP.Size = currentESP.Adornee.Size
- end
- end)
- local function showNotification()
- local notification = Instance.new("TextLabel")
- notification.Parent = gui
- notification.Size = UDim2.new(0.3, 0, 0.05, 0)
- notification.Position = UDim2.new(1, 0, 0.9, 0)
- notification.BackgroundTransparency = 0.5
- notification.BackgroundColor3 = Color3.new(0, 0, 0)
- notification.BorderSizePixel = 0
- notification.TextScaled = true
- notification.TextWrapped = true
- notification.TextColor3 = Color3.new(1, 1, 1)
- notification.Text = "Press 'T' to freeze and unfreeze the GUI or press 'Y' to hide the GUI"
- local tweenIn = TweenService:Create(notification, TweenInfo.new(1), {Position = UDim2.new(0.65, 0, 0.9, 0)})
- local tweenOut = TweenService:Create(notification, TweenInfo.new(1), {Position = UDim2.new(1, 0, 0.9, 0)})
- tweenIn:Play()
- wait(3)
- tweenOut:Play()
- tweenOut.Completed:Wait()
- notification:Destroy()
- end
- showNotification()
- local function closeGui()
- gui:Destroy()
- end
- -- Create the "X" button
- local closeButton = Instance.new("TextButton")
- closeButton.Parent = frameOuter
- closeButton.Size = UDim2.new(0, 20, 0, 20)
- closeButton.Position = UDim2.new(1, -20, 0, 0)
- closeButton.BackgroundColor3 = Color3.new(1, 0, 0)
- closeButton.BorderSizePixel = 0
- closeButton.Text = "X"
- closeButton.TextColor3 = Color3.new(1, 1, 1)
- closeButton.TextScaled = true
- closeButton.MouseButton1Click:Connect(closeGui)
Advertisement
Advertisement