-- Assuming 'owner' is a valid player object
local player = owner
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local copiedObject = nil
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "UtilityGUI"
screenGui.Parent = player:WaitForChild("PlayerGui")
-- Main Frame
local mainFrame = Instance.new("Frame", screenGui)
mainFrame.Size = UDim2.new(0, 400, 0, 400)
mainFrame.Position = UDim2.new(0.5, -200, 0.5, -200)
mainFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
mainFrame.BorderSizePixel = 0
-- Explorer Frame
local explorerFrame = Instance.new("Frame", mainFrame)
explorerFrame.Size = UDim2.new(0.5, -10, 1, -20)
explorerFrame.Position = UDim2.new(0, 10, 0, 10)
explorerFrame.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
explorerFrame.BorderSizePixel = 0
explorerFrame.Visible = false
-- Explorer Title
local explorerTitle = Instance.new("TextLabel", explorerFrame)
explorerTitle.Size = UDim2.new(1, 0, 0, 30)
explorerTitle.Position = UDim2.new(0, 0, 0, 0)
explorerTitle.Text = "Explorer"
explorerTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
explorerTitle.BackgroundTransparency = 1
explorerTitle.Font = Enum.Font.SourceSansBold
explorerTitle.TextSize = 20
-- Toggle Button for Explorer
local toggleExplorerButton = Instance.new("TextButton", mainFrame)
toggleExplorerButton.Size = UDim2.new(0, 100, 0, 30)
toggleExplorerButton.Position = UDim2.new(0, 10, 1, -40)
toggleExplorerButton.Text = "Toggle Explorer"
toggleExplorerButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
toggleExplorerButton.MouseButton1Click:Connect(function()
explorerFrame.Visible = not explorerFrame.Visible
end)
-- Properties Frame
local propertiesFrame = Instance.new("Frame", mainFrame)
propertiesFrame.Size = UDim2.new(0.5, -10, 1, -20)
propertiesFrame.Position = UDim2.new(0.5, 0, 0, 10)
propertiesFrame.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
propertiesFrame.BorderSizePixel = 0
propertiesFrame.Visible = false
-- Properties Title
local propertiesTitle = Instance.new("TextLabel", propertiesFrame)
propertiesTitle.Size = UDim2.new(1, 0, 0, 30)
propertiesTitle.Position = UDim2.new(0, 0, 0, 0)
propertiesTitle.Text = "Properties"
propertiesTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
propertiesTitle.BackgroundTransparency = 1
propertiesTitle.Font = Enum.Font.SourceSansBold
propertiesTitle.TextSize = 20
-- Function to create context menu for an object
local function createContextMenu(parent, object)
local contextMenu = Instance.new("Frame", parent)
contextMenu.Size = UDim2.new(0, 150, 0, 120)
contextMenu.Position = UDim2.new(1, 0, 0, 0)
contextMenu.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
contextMenu.BorderSizePixel = 0
contextMenu.Visible = false
local actions = {"Clone", "Delete", "Copy", "Paste"}
for i, action in ipairs(actions) do
local actionButton = Instance.new("TextButton", contextMenu)
actionButton.Size = UDim2.new(1, -20, 0, 30)
actionButton.Position = UDim2.new(0, 10, 0, 10 + (i - 1) * 35)
actionButton.Text = action
actionButton.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
if action == "Clone" then
actionButton.MouseButton1Click:Connect(function()
object:Clone().Parent = object.Parent
end)
elseif action == "Delete" then
actionButton.MouseButton1Click:Connect(function()
object:Destroy()
end)
-- Function to update the properties panel
local function updatePropertiesPanel(object)
-- Clear existing properties
for _, child in ipairs(propertiesFrame:GetChildren()) do
if child:IsA("TextLabel") then
child:Destroy()
end
end
-- Show properties of the selected object
local properties = {
{"Name", object.Name},
{"ClassName", object.ClassName},
{"Position", tostring(object.Position)},
{"Size", tostring(object.Size)},
{"Rotation", tostring(object.Rotation)},
{"Anchored", tostring(object.Anchored)},
{"CanCollide", tostring(object.CanCollide)},
{"Visibility", tostring(object.Visible)},
}
local yPos = 10
for _, prop in ipairs(properties) do
local propLabel = Instance.new("TextLabel", propertiesFrame)
propLabel.Size = UDim2.new(1, -20, 0, 20)
propLabel.Position = UDim2.new(0, 10, 0, yPos)
propLabel.Text = prop[1] .. ": " .. prop[2]
propLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
propLabel.BackgroundTransparency = 1
propLabel.TextSize = 16
yPos = yPos + 25
end
end
-- Function to update the explorer with current objects
local function updateExplorer()
-- Clear existing items in explorer
for _, child in ipairs(explorerFrame:GetChildren()) do
if child:IsA("TextButton") then
child:Destroy()
end
end
-- Populate with current objects in game.Workspace
local objects = game.Workspace:GetChildren()
for i, obj in ipairs(objects) do
local itemButton = Instance.new("TextButton", explorerFrame)
itemButton.Size = UDim2.new(1, -20, 0, 30)
itemButton.Position = UDim2.new(0, 10, 0, (i - 1) * 35 + 35)
itemButton.Text = obj.Name
itemButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
-- Context menu for each object
local contextMenu = Instance.new("Frame", itemButton)
contextMenu.Size = UDim2.new(0, 150, 0, 120)
contextMenu.Position = UDim2.new(1, 0, 0, 0)
contextMenu.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
contextMenu.BorderSizePixel = 0
contextMenu.Visible = false
local actions = {"Clone", "Delete", "Copy", "Paste"}
for j, action in ipairs(actions) do
local actionButton = Instance.new("TextButton", contextMenu)
actionButton.Size = UDim2.new(1, -20, 0, 30)
actionButton.Position = UDim2.new(0, 10, 0, 10 + (j - 1) * 35)
actionButton.Text = action
actionButton.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
-- Connect actions to buttons
if action == "Clone" then
actionButton.MouseButton1Click:Connect(function()
obj:Clone().Parent = obj.Parent
updateExplorer()
end)
elseif action == "Delete" then
actionButton.MouseButton1Click:Connect(function()
obj:Destroy()
updateExplorer()
end)
elseif action == "Copy" then
actionButton.MouseButton1Click:Connect(function()
copiedObject = obj
end)
elseif action == "Paste" then
actionButton.MouseButton1Click:Connect(function()
if copiedObject then
copiedObject:Clone().Parent = obj.Parent
updateExplorer()
end
end)
end
end
-- Toggle context menu visibility
itemButton.MouseButton2Click:Connect(function()
contextMenu.Visible = not contextMenu.Visible
end)
-- Selection and properties update
itemButton.MouseButton1Click:Connect(function()
updatePropertiesPanel(obj)
end)
end
-- Update the CanvasSize to fit all items
local layoutHeight = #objects * 35
explorerFrame.CanvasSize = UDim2.new(0, 0, 0, layoutHeight)
end
-- Initially populate the explorer
updateExplorer()
-- Run the initial population of the explorer when the script starts
game.Workspace.ChildAdded:Connect(updateExplorer)
game.Workspace.ChildRemoved:Connect(updateExplorer)
end