Ameno__GodOH

script that for some reason doesn't want to work anymore

Aug 10th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. -- Function to create the GUI with a draggable border and a scrolling frame
  2. local function createGUI()
  3. local screenGui = Instance.new("ScreenGui")
  4. screenGui.Name = "NPCListGui"
  5. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  6.  
  7. local frame = Instance.new("Frame")
  8. frame.Size = UDim2.new(0.3, 0, 0.5, 0)
  9. frame.Position = UDim2.new(0.35, 0, 0.25, 0)
  10. frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  11. frame.BackgroundTransparency = 0.5
  12. frame.BorderSizePixel = 2
  13. frame.BorderColor3 = Color3.fromRGB(255, 255, 255)
  14. frame.Parent = screenGui
  15.  
  16. local titleLabel = Instance.new("TextLabel")
  17. titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
  18. titleLabel.Position = UDim2.new(0, 0, 0, 0)
  19. titleLabel.Text = "Test"
  20. titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  21. titleLabel.BackgroundTransparency = 1
  22. titleLabel.Parent = frame
  23.  
  24. local scrollingFrame = Instance.new("ScrollingFrame")
  25. scrollingFrame.Size = UDim2.new(1, 0, 0.9, 0)
  26. scrollingFrame.Position = UDim2.new(0, 0, 0.1, 0)
  27. scrollingFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  28. scrollingFrame.BackgroundTransparency = 0.5
  29. scrollingFrame.BorderSizePixel = 0
  30. scrollingFrame.ScrollBarThickness = 12
  31. scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  32. scrollingFrame.Parent = frame
  33.  
  34. local uiListLayout = Instance.new("UIListLayout")
  35. uiListLayout.Parent = scrollingFrame
  36. uiListLayout.FillDirection = Enum.FillDirection.Vertical
  37. uiListLayout.SortOrder = Enum.SortOrder.Name
  38.  
  39. -- Function to create the draggable border
  40. local function addDraggable(frame)
  41. local dragging = false
  42. local dragInput, mousePos, framePos
  43.  
  44. local function update(input)
  45. local delta = input.Position - mousePos
  46. frame.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y)
  47. end
  48.  
  49. frame.InputBegan:Connect(function(input)
  50. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  51. dragging = true
  52. mousePos = input.Position
  53. framePos = frame.Position
  54. input.Changed:Connect(function()
  55. if input.UserInputState == Enum.UserInputState.End then
  56. dragging = false
  57. end
  58. end)
  59. end
  60. end)
  61.  
  62. frame.InputChanged:Connect(function(input)
  63. if input.UserInputType == Enum.UserInputType.MouseMovement then
  64. dragInput = input
  65. end
  66. end)
  67.  
  68. game:GetService("UserInputService").InputChanged:Connect(function(input)
  69. if input == dragInput and dragging then
  70. update(input)
  71. end
  72. end)
  73. end
  74.  
  75. addDraggable(frame)
  76.  
  77. return scrollingFrame
  78. end
  79.  
  80. -- Function to create a button for a boss
  81. local function createButton(bossName, parent)
  82. local button = Instance.new("TextButton")
  83. button.Size = UDim2.new(1, 0, 0, 50)
  84. button.Text = bossName
  85. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  86. button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  87. button.BackgroundTransparency = 0.5
  88. button.Parent = parent
  89.  
  90. button.MouseButton1Click:Connect(function()
  91. -- Find the boss by name and change to R15
  92. local boss = game.Workspace:FindFirstChild("NPCs"):FindFirstChild("Boss"):FindFirstChild(bossName)
  93. if boss and boss:IsA("Model") then
  94. local humanoid = boss:FindFirstChildOfClass("Humanoid")
  95. if humanoid then
  96. -- Change the boss to R15
  97. humanoid.RigType = Enum.HumanoidRigType.R15
  98. end
  99. end
  100. end)
  101. end
  102.  
  103. -- Function to update the interface with the bosses
  104. local function updateBossInterface()
  105. local scrollingFrame = createGUI()
  106. local bossesFolder = game.Workspace:FindFirstChild("NPCs") and game.Workspace.NPCs:FindFirstChild("Boss")
  107.  
  108. if not bossesFolder then
  109. local noBossesLabel = Instance.new("TextLabel")
  110. noBossesLabel.Size = UDim2.new(1, 0, 1, 0)
  111. noBossesLabel.Text = "Boss folder not found."
  112. noBossesLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  113. noBossesLabel.BackgroundTransparency = 1
  114. noBossesLabel.Parent = scrollingFrame
  115. return
  116. end
  117.  
  118. for _, boss in pairs(bossesFolder:GetChildren()) do
  119. if boss:IsA("Model") then
  120. createButton(boss.Name, scrollingFrame)
  121. end
  122. end
  123.  
  124. -- Update the CanvasSize of the ScrollingFrame based on the number of buttons
  125. local totalButtonsHeight = #bossesFolder:GetChildren() * 50 -- 50 is the height of each button
  126. scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, totalButtonsHeight)
  127. end
  128.  
  129. -- Update the interface when the script runs
  130. updateBossInterface()
Advertisement
Add Comment
Please, Sign In to add comment