Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local gui = Instance.new("ScreenGui", player.PlayerGui)
- gui.ResetOnSpawn = false
- gui.Name = "ChildViewer"
- local box = Instance.new("SelectionBox", gui)
- local frame = Instance.new("Frame", gui)
- frame.AnchorPoint = Vector2.new(0, 0.5)
- frame.Position = UDim2.new(0, 0, 0.5, 0)
- frame.Size = UDim2.new(0.25, 0, 0.65, 0)
- frame.BorderColor3 = Color3.new(0, 0, 0)
- frame.BackgroundColor3 = Color3.new(1, 1, 1)
- frame.Transparency = 0.5
- frame.Active = true
- frame.Draggable = true
- local childrenFrame = Instance.new("ScrollingFrame", gui)
- childrenFrame.Visible = false
- childrenFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- childrenFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
- childrenFrame.Size = UDim2.new(0.4, 0, 0.7, 0)
- childrenFrame.BorderColor3 = Color3.new(0, 0, 0)
- childrenFrame.BackgroundColor3 = Color3.new(1, 1, 1)
- childrenFrame.Transparency = 0.5
- childrenFrame.CanvasSize = UDim2.new(0, 0, 100, 0)
- Instance.new("UIPadding", childrenFrame).PaddingTop = UDim.new(0, 25)
- local listLay = Instance.new("UIListLayout", childrenFrame)
- listLay.Padding = UDim.new(0, 25)
- listLay.HorizontalAlignment = Enum.HorizontalAlignment.Center
- local partName = Instance.new("TextLabel", frame)
- partName.BackgroundTransparency = 1
- partName.AnchorPoint = Vector2.new(0.5, 0)
- partName.Text = "No part selected"
- partName.TextColor3 = Color3.new(0, 0, 0)
- partName.TextScaled = true
- partName.Size = UDim2.new(0.9, 0, 0.1, 0)
- partName.Position = UDim2.new(0.5, 0, 0.1, 0)
- local partParent = Instance.new("TextLabel", frame)
- partParent.BackgroundTransparency = 1
- partParent.AnchorPoint = Vector2.new(0, 0)
- partParent.Text = "No part selected"
- partParent.TextColor3 = Color3.new(0, 0, 0)
- partParent.TextScaled = true
- partParent.RichText = true
- partParent.Size = UDim2.new(0.9, 0, 0.1, 0)
- partParent.Position = UDim2.new(0.05, 0, 0.25, 0)
- partParent.TextXAlignment = Enum.TextXAlignment.Left
- local partPos = Instance.new("TextLabel", frame)
- partPos.BackgroundTransparency = 1
- partPos.AnchorPoint = Vector2.new(0, 0)
- partPos.Text = "No part selected"
- partPos.TextColor3 = Color3.new(0, 0, 0)
- partPos.TextScaled = true
- partPos.RichText = true
- partPos.Size = UDim2.new(0.9, 0, 0.1, 0)
- partPos.Position = UDim2.new(0.05, 0, 0.4, 0)
- partPos.TextXAlignment = Enum.TextXAlignment.Left
- local partSize = Instance.new("TextLabel", frame)
- partSize.BackgroundTransparency = 1
- partSize.AnchorPoint = Vector2.new(0, 0)
- partSize.Text = "No part selected"
- partSize.TextColor3 = Color3.new(0, 0, 0)
- partSize.TextScaled = true
- partSize.RichText = true
- partSize.Size = UDim2.new(0.9, 0, 0.1, 0)
- partSize.Position = UDim2.new(0.05, 0, 0.55, 0)
- partSize.TextXAlignment = Enum.TextXAlignment.Left
- local tpPart = Instance.new("TextButton", frame)
- tpPart.BackgroundTransparency = 0.375
- tpPart.AnchorPoint = Vector2.new(0.5, 0)
- tpPart.Text = "Teleport to Part"
- tpPart.TextColor3 = Color3.new(0, 0, 0)
- tpPart.TextScaled = true
- tpPart.RichText = true
- tpPart.Size = UDim2.new(0.5, 0, 0.1, 0)
- tpPart.BorderColor3 = Color3.new(0, 0, 0)
- tpPart.BackgroundColor3 = Color3.new(1, 1, 1)
- tpPart.Position = UDim2.new(0.5, 0, 0.725, 0)
- local partChildren = Instance.new("TextButton", frame)
- partChildren.BackgroundTransparency = 0.375
- partChildren.AnchorPoint = Vector2.new(0.5, 0)
- partChildren.Text = "View Descendants of Part"
- partChildren.TextColor3 = Color3.new(0, 0, 0)
- partChildren.TextScaled = true
- partChildren.RichText = true
- partChildren.Size = UDim2.new(0.5, 0, 0.1, 0)
- partChildren.BorderColor3 = Color3.new(0, 0, 0)
- partChildren.BackgroundColor3 = Color3.new(1, 1, 1)
- partChildren.Position = UDim2.new(0.5, 0, 0.85, 0)
- local function get()
- local ray = Ray.new(mouse.UnitRay.Origin, mouse.UnitRay.Direction * 1000)
- return workspace:FindPartOnRayWithIgnoreList(ray, { player.Character })
- end
- local foundPart = false
- mouse.Button2Down:Connect(function()
- local part, position = get()
- if part then
- local fullName = part:GetFullName()
- local lowered = string.split(fullName, ".")
- lowered[1] = string.lower(lowered[1])
- lowered = table.concat(lowered, ".")
- foundPart = true
- box.Adornee = part
- partName.Text = `"{part.Name}"`
- partParent.Text = `Parent: <b>{lowered}</b>`
- partPos.Text = `Position: <b>{part.Position}</b>`
- partSize.Text = `Size: <b>{part.Size}</b>`
- else
- foundPart = false
- box.Adornee = nil
- partName.Text = "No part selected"
- partParent.Text = "No part selected"
- partPos.Text = "No part selected"
- partSize.Text = "No part selected"
- end
- end)
- local opened = false
- local function childrenViewer()
- if foundPart then
- opened = not opened
- for i, v in pairs(childrenFrame:GetChildren()) do if v:IsA("TextLabel") then v:Destroy() end end
- childrenFrame.Visible = opened
- local children = box.Adornee:GetDescendants()
- for i, v in pairs(children) do
- local child = Instance.new("TextLabel", childrenFrame)
- child.Size = UDim2.new(0.9, 0, 0, 50)
- child.BorderColor3 = Color3.new(0, 0, 0)
- child.BackgroundColor3 = Color3.new(1, 1, 1)
- child.Transparency = 0.25
- child.TextScaled = true
- child.TextXAlignment = Enum.TextXAlignment.Left
- local fullName = v:GetFullName()
- local lowered = string.split(fullName, ".")
- lowered[1] = string.lower(lowered[1])
- lowered = table.concat(lowered, ".")
- child.Text = `{lowered} ({v.ClassName})`
- end
- else
- game.StarterGui:SetCore("SendNotification", {
- Title = "Error",
- Text = "You have no part selected.",
- Duration = 2
- })
- end
- end
- local function tpToPart()
- if foundPart then
- local character = player.Character
- local hrp = character:FindFirstChild("HumanoidRootPart")
- if hrp then
- hrp.CFrame = box.Adornee.CFrame
- end
- else
- game.StarterGui:SetCore("SendNotification", {
- Title = "Error",
- Text = "You have no part selected.",
- Duration = 2
- })
- end
- end
- partChildren.MouseButton1Click:Connect(childrenViewer)
- tpPart.MouseButton1Click:Connect(tpToPart)
- game.UserInputService.InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.T then
- tpToPart()
- end
- end)
- task.wait(1)
- game.StarterGui:SetCore("SendNotification", {
- Title = "Controls",
- Text = "Right click on a part to see its info\nT to teleport to the selected part",
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement