Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to create the GUI with a draggable border and a scrolling frame
- local function createGUI()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "NPCListGui"
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0.3, 0, 0.5, 0)
- frame.Position = UDim2.new(0.35, 0, 0.25, 0)
- frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- frame.BackgroundTransparency = 0.5
- frame.BorderSizePixel = 2
- frame.BorderColor3 = Color3.fromRGB(255, 255, 255)
- frame.Parent = screenGui
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
- titleLabel.Position = UDim2.new(0, 0, 0, 0)
- titleLabel.Text = "Test"
- titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- titleLabel.BackgroundTransparency = 1
- titleLabel.Parent = frame
- local scrollingFrame = Instance.new("ScrollingFrame")
- scrollingFrame.Size = UDim2.new(1, 0, 0.9, 0)
- scrollingFrame.Position = UDim2.new(0, 0, 0.1, 0)
- scrollingFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- scrollingFrame.BackgroundTransparency = 0.5
- scrollingFrame.BorderSizePixel = 0
- scrollingFrame.ScrollBarThickness = 12
- scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
- scrollingFrame.Parent = frame
- local uiListLayout = Instance.new("UIListLayout")
- uiListLayout.Parent = scrollingFrame
- uiListLayout.FillDirection = Enum.FillDirection.Vertical
- uiListLayout.SortOrder = Enum.SortOrder.Name
- -- Function to create the draggable border
- local function addDraggable(frame)
- local dragging = false
- local dragInput, mousePos, framePos
- local function update(input)
- local delta = input.Position - mousePos
- frame.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y)
- end
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- mousePos = input.Position
- framePos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- frame.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- end
- addDraggable(frame)
- return scrollingFrame
- end
- -- Function to create a button for a boss
- local function createButton(bossName, parent)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, 0, 0, 50)
- button.Text = bossName
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- button.BackgroundTransparency = 0.5
- button.Parent = parent
- button.MouseButton1Click:Connect(function()
- -- Find the boss by name and change to R15
- local boss = game.Workspace:FindFirstChild("NPCs"):FindFirstChild("Boss"):FindFirstChild(bossName)
- if boss and boss:IsA("Model") then
- local humanoid = boss:FindFirstChildOfClass("Humanoid")
- if humanoid then
- -- Change the boss to R15
- humanoid.RigType = Enum.HumanoidRigType.R15
- end
- end
- end)
- end
- -- Function to update the interface with the bosses
- local function updateBossInterface()
- local scrollingFrame = createGUI()
- local bossesFolder = game.Workspace:FindFirstChild("NPCs") and game.Workspace.NPCs:FindFirstChild("Boss")
- if not bossesFolder then
- local noBossesLabel = Instance.new("TextLabel")
- noBossesLabel.Size = UDim2.new(1, 0, 1, 0)
- noBossesLabel.Text = "Boss folder not found."
- noBossesLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
- noBossesLabel.BackgroundTransparency = 1
- noBossesLabel.Parent = scrollingFrame
- return
- end
- for _, boss in pairs(bossesFolder:GetChildren()) do
- if boss:IsA("Model") then
- createButton(boss.Name, scrollingFrame)
- end
- end
- -- Update the CanvasSize of the ScrollingFrame based on the number of buttons
- local totalButtonsHeight = #bossesFolder:GetChildren() * 50 -- 50 is the height of each button
- scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, totalButtonsHeight)
- end
- -- Update the interface when the script runs
- updateBossInterface()
Advertisement
Add Comment
Please, Sign In to add comment