Advertisement
PC55654

Seraphus

Sep 14th, 2023 (edited)
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.79 KB | Source Code | 0 0
  1. -- Reference to the player
  2. local player = game.Players.LocalPlayer
  3.  
  4. -- Function to set specific BoolValue instances to "On"
  5. local function setCheckpointsOn()
  6.     -- List of checkpoint names
  7.     local checkpointNames = {"0m", "100m", "200m", "300m", "400m", "500m"}
  8.  
  9.     -- Find the "PlayerInventory" folder in the player
  10.     local playerInventory = player:FindFirstChild("PlayerInventory")
  11.  
  12.     -- Check if the "PlayerInventory" folder exists
  13.     if playerInventory then
  14.         -- Find the "Checkpoints" folder inside the "PlayerInventory" folder
  15.         local checkpointsFolder = playerInventory:FindFirstChild("Checkpoints")
  16.  
  17.         -- Check if the "Checkpoints" folder exists
  18.         if checkpointsFolder then
  19.             -- Iterate through the checkpoint names
  20.             for _, checkpointName in ipairs(checkpointNames) do
  21.                 local checkpoint = checkpointsFolder:FindFirstChild(checkpointName)
  22.  
  23.                 -- Check if the checkpoint exists and is a BoolValue
  24.                 if checkpoint and checkpoint:IsA("BoolValue") then
  25.                     checkpoint.Value = true -- Set the BoolValue to "On"
  26.                 end
  27.             end
  28.         end
  29.     end
  30. end
  31.  
  32. -- Function to handle the "Delete" button click
  33. local function onDeleteButtonClick()
  34.     local username = player.Name -- Get the player's username
  35.     local ballsFolder = workspace:FindFirstChild("Balls") -- Find the "Balls" folder in the workspace
  36.  
  37.     -- Check if the "Balls" folder exists
  38.     if ballsFolder then
  39.         local ballToRemove = ballsFolder:FindFirstChild(username) -- Find the ball with the player's username
  40.  
  41.         -- Check if the ball exists
  42.         if ballToRemove then
  43.             ballToRemove:Destroy() -- Remove the ball
  44.             print(username .. "'s ball has been deleted.")
  45.         else
  46.             print("Ball not found for " .. username)
  47.         end
  48.     else
  49.         print("Balls folder not found in the workspace.")
  50.     end
  51. end
  52.  
  53. -- Create a ScreenGui
  54. local screenGui = Instance.new("ScreenGui")
  55. screenGui.Parent = game.Players.LocalPlayer.PlayerGui
  56. screenGui.ResetOnSpawn = false -- Disable ResetOnSpawn for the ScreenGui
  57.  
  58. -- Create a Frame to hold the buttons
  59. local frame = Instance.new("Frame")
  60. frame.Parent = screenGui
  61. frame.Size = UDim2.new(0, 200, 0, 100) -- Set the size of the frame
  62. frame.Position = UDim2.new(0.5, -100, 0.5, -50) -- Position the frame in the center of the screen
  63. frame.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) -- Set the frame background color
  64.  
  65. -- Variables for frame dragging
  66. local isDragging = false
  67. local offset = Vector2.new(0, 0)
  68.  
  69. -- Mouse input handlers for frame dragging
  70. frame.InputBegan:Connect(function(input)
  71.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  72.         isDragging = true
  73.         offset = frame.Position - UDim2.new(0, input.Position.X, 0, input.Position.Y)
  74.     end
  75. end)
  76.  
  77. frame.InputEnded:Connect(function(input)
  78.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  79.         isDragging = false
  80.     end
  81. end)
  82.  
  83. frame.InputChanged:Connect(function(input)
  84.     if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  85.         local newPosition = UDim2.new(0, input.Position.X, 0, input.Position.Y) + offset
  86.         frame.Position = newPosition
  87.     end
  88. end)
  89.  
  90. -- Create the "Unlock" button
  91. local unlockButton = Instance.new("TextButton")
  92. unlockButton.Parent = frame
  93. unlockButton.Size = UDim2.new(0, 180, 0, 40) -- Set the size of the button
  94. unlockButton.Position = UDim2.new(0.5, -90, 0.2, -20) -- Position the button inside the frame
  95. unlockButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Set the button background color to black
  96. unlockButton.TextColor3 = Color3.new(1, 1, 1) -- Set the text color to white
  97. unlockButton.Text = "Unlock All Checkpoints" -- Set the button text
  98. unlockButton.FontSize = Enum.FontSize.Size18 -- Auto scale text size
  99. unlockButton.TextScaled = true -- Auto scale text size based on button size
  100. unlockButton.MouseButton1Click:Connect(setCheckpointsOn) -- Connect the click event to setCheckpointsOn
  101.  
  102. -- Create the "Delete" button
  103. local deleteButton = Instance.new("TextButton")
  104. deleteButton.Parent = frame
  105. deleteButton.Size = UDim2.new(0, 180, 0, 40) -- Set the size of the button
  106. deleteButton.Position = UDim2.new(0.5, -90, 0.6, -20) -- Position the button inside the frame
  107. deleteButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Set the button background color to black
  108. deleteButton.TextColor3 = Color3.new(1, 1, 1) -- Set the text color to white
  109. deleteButton.Text = "Delete" -- Set the button text
  110. deleteButton.FontSize = Enum.FontSize.Size18 -- Auto scale text size
  111. deleteButton.TextScaled = true -- Auto scale text size based on button size
  112. deleteButton.MouseButton1Click:Connect(onDeleteButtonClick) -- Connect the click event to onDeleteButtonClick
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement