Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Reference to the player
- local player = game.Players.LocalPlayer
- -- Function to set specific BoolValue instances to "On"
- local function setCheckpointsOn()
- -- List of checkpoint names
- local checkpointNames = {"0m", "100m", "200m", "300m", "400m", "500m"}
- -- Find the "PlayerInventory" folder in the player
- local playerInventory = player:FindFirstChild("PlayerInventory")
- -- Check if the "PlayerInventory" folder exists
- if playerInventory then
- -- Find the "Checkpoints" folder inside the "PlayerInventory" folder
- local checkpointsFolder = playerInventory:FindFirstChild("Checkpoints")
- -- Check if the "Checkpoints" folder exists
- if checkpointsFolder then
- -- Iterate through the checkpoint names
- for _, checkpointName in ipairs(checkpointNames) do
- local checkpoint = checkpointsFolder:FindFirstChild(checkpointName)
- -- Check if the checkpoint exists and is a BoolValue
- if checkpoint and checkpoint:IsA("BoolValue") then
- checkpoint.Value = true -- Set the BoolValue to "On"
- end
- end
- end
- end
- end
- -- Function to handle the "Delete" button click
- local function onDeleteButtonClick()
- local username = player.Name -- Get the player's username
- local ballsFolder = workspace:FindFirstChild("Balls") -- Find the "Balls" folder in the workspace
- -- Check if the "Balls" folder exists
- if ballsFolder then
- local ballToRemove = ballsFolder:FindFirstChild(username) -- Find the ball with the player's username
- -- Check if the ball exists
- if ballToRemove then
- ballToRemove:Destroy() -- Remove the ball
- print(username .. "'s ball has been deleted.")
- else
- print("Ball not found for " .. username)
- end
- else
- print("Balls folder not found in the workspace.")
- end
- end
- -- Create a ScreenGui
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer.PlayerGui
- screenGui.ResetOnSpawn = false -- Disable ResetOnSpawn for the ScreenGui
- -- Create a Frame to hold the buttons
- local frame = Instance.new("Frame")
- frame.Parent = screenGui
- frame.Size = UDim2.new(0, 200, 0, 100) -- Set the size of the frame
- frame.Position = UDim2.new(0.5, -100, 0.5, -50) -- Position the frame in the center of the screen
- frame.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) -- Set the frame background color
- -- Variables for frame dragging
- local isDragging = false
- local offset = Vector2.new(0, 0)
- -- Mouse input handlers for frame dragging
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = true
- offset = frame.Position - UDim2.new(0, input.Position.X, 0, input.Position.Y)
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = false
- end
- end)
- frame.InputChanged:Connect(function(input)
- if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local newPosition = UDim2.new(0, input.Position.X, 0, input.Position.Y) + offset
- frame.Position = newPosition
- end
- end)
- -- Create the "Unlock" button
- local unlockButton = Instance.new("TextButton")
- unlockButton.Parent = frame
- unlockButton.Size = UDim2.new(0, 180, 0, 40) -- Set the size of the button
- unlockButton.Position = UDim2.new(0.5, -90, 0.2, -20) -- Position the button inside the frame
- unlockButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Set the button background color to black
- unlockButton.TextColor3 = Color3.new(1, 1, 1) -- Set the text color to white
- unlockButton.Text = "Unlock All Checkpoints" -- Set the button text
- unlockButton.FontSize = Enum.FontSize.Size18 -- Auto scale text size
- unlockButton.TextScaled = true -- Auto scale text size based on button size
- unlockButton.MouseButton1Click:Connect(setCheckpointsOn) -- Connect the click event to setCheckpointsOn
- -- Create the "Delete" button
- local deleteButton = Instance.new("TextButton")
- deleteButton.Parent = frame
- deleteButton.Size = UDim2.new(0, 180, 0, 40) -- Set the size of the button
- deleteButton.Position = UDim2.new(0.5, -90, 0.6, -20) -- Position the button inside the frame
- deleteButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Set the button background color to black
- deleteButton.TextColor3 = Color3.new(1, 1, 1) -- Set the text color to white
- deleteButton.Text = "Delete" -- Set the button text
- deleteButton.FontSize = Enum.FontSize.Size18 -- Auto scale text size
- deleteButton.TextScaled = true -- Auto scale text size based on button size
- deleteButton.MouseButton1Click:Connect(onDeleteButtonClick) -- Connect the click event to onDeleteButtonClick
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement