Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UserInputService = game:GetService("UserInputService")
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- -- Ждём загрузки персонажа
- local function waitForCharacter()
- while not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") do
- wait(0.5)
- end
- return LocalPlayer.Character
- end
- -- Create ScreenGui
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = LocalPlayer.PlayerGui
- screenGui.ResetOnSpawn = false
- screenGui.Enabled = true -- Меню видно сразу
- -- Create main frame
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 200)
- frame.Position = UDim2.new(0.5, -150, 0.5, -100)
- frame.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- frame.BackgroundTransparency = 0.2
- frame.Active = true
- frame.Draggable = true
- frame.Parent = screenGui
- -- Create title label for coordinates
- local coordLabel = Instance.new("TextLabel")
- coordLabel.Size = UDim2.new(1, 0, 0, 30)
- coordLabel.Position = UDim2.new(0, 0, 0, 0)
- coordLabel.BackgroundTransparency = 1
- coordLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- coordLabel.Text = "X: 0, Y: 0, Z: 0"
- coordLabel.Parent = frame
- -- Create Stage 1 button
- local stage1Button = Instance.new("TextButton")
- stage1Button.Size = UDim2.new(0, 100, 0, 30)
- stage1Button.Position = UDim2.new(0, 10, 0, 40)
- stage1Button.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- stage1Button.TextColor3 = Color3.fromRGB(255, 255, 255)
- stage1Button.Text = "Start Challenge"
- stage1Button.Parent = frame
- -- Variables
- local isMinimized = false
- local isMoving = false
- local waypoints = {
- Vector3.new(320.00, 0, -461.78),
- Vector3.new(212.07, 0, -461.78),
- Vector3.new(212.07, 0, -640.35),
- Vector3.new(244.00, 0, -640.35)
- }
- local currentWaypointIndex = 0
- -- Function to update coordinates
- local function startCoordinateUpdates()
- RunService.RenderStepped:Connect(function()
- if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
- local pos = LocalPlayer.Character.HumanoidRootPart.Position
- coordLabel.Text = string.format("X: %.2f, Y: %.2f, Z: %.2f", pos.X, pos.Y, pos.Z)
- else
- coordLabel.Text = "X: 0, Y: 0, Z: 0"
- end
- end)
- end
- -- Start coordinate updates after character load
- spawn(function()
- waitForCharacter()
- startCoordinateUpdates()
- end)
- -- Home key functionality (minimize/maximize)
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then return end
- if input.KeyCode == Enum.KeyCode.Home then
- isMinimized = not isMinimized
- if isMinimized then
- frame.Size = UDim2.new(0, 300, 0, 30)
- stage1Button.Visible = false
- else
- frame.Size = UDim2.new(0, 300, 0, 200)
- stage1Button.Visible = true
- end
- end
- end)
- -- Insert key functionality (disable script)
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then return end
- if input.KeyCode == Enum.KeyCode.Insert then
- screenGui:Destroy()
- end
- end)
- -- Function to click a button (generic)
- local function clickButton(button)
- if button then
- local clickDetector = button:FindFirstChildOfClass("ClickDetector")
- if clickDetector then
- fireclickdetector(clickDetector)
- elseif button:IsA("TextButton") then
- local connections = getconnections(button.Activated) or getconnections(button.MouseButton1Click)
- for _, connection in pairs(connections) do
- connection:Fire()
- end
- end
- end
- end
- -- Function to click the Start button
- local function clickStartButton()
- local startButton = LocalPlayer.PlayerGui:FindFirstChild("MiniLobbyInterface")
- and LocalPlayer.PlayerGui.MiniLobbyInterface:FindFirstChild("Holder")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder:FindFirstChild("Buttons")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder.Buttons:FindFirstChild("Start")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder.Buttons.Start:FindFirstChild("Button")
- if startButton then
- clickButton(startButton)
- end
- end
- -- Function to click the Play button and save StageName before Start
- local function clickPlayButton(challengeTemplate)
- local playButton = challengeTemplate:FindFirstChild("SideFrame")
- and challengeTemplate.SideFrame:FindFirstChild("Play")
- and challengeTemplate.SideFrame.Play:FindFirstChild("Button")
- if playButton then
- clickButton(playButton) -- Нажимаем Play
- wait(1) -- Ждём немного после нажатия Play
- -- Получаем StageName
- local stageNameLabel = LocalPlayer.PlayerGui:FindFirstChild("MiniLobbyInterface")
- and LocalPlayer.PlayerGui.MiniLobbyInterface:FindFirstChild("Holder")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder:FindFirstChild("Info")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder.Info:FindFirstChild("Container")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder.Info.Container:FindFirstChild("Main")
- and LocalPlayer.PlayerGui.MiniLobbyInterface.Holder.Info.Container.Main:FindFirstChild("StageName")
- -- Читаем существующие Stage и Act из файла (если файл существует)
- local stageText = "Not available"
- local actText = "Not available"
- if isfile("actinfo.txt") then
- local fileContent = readfile("actinfo.txt")
- local lines = {}
- for line in fileContent:gmatch("[^\r\n]+") do
- table.insert(lines, line)
- end
- if #lines >= 2 then
- stageText = lines[2] or "Not available"
- actText = lines[3] or "Not available"
- end
- end
- -- Получаем StageName
- local stageNameText = "Not available"
- if stageNameLabel and stageNameLabel:IsA("TextLabel") then
- stageNameText = stageNameLabel.Text
- print("StageName found: " .. stageNameText)
- else
- print("StageName label not found")
- end
- -- Формируем содержимое файла
- local fileContent = "Act info :\n" .. stageText .. "\n" .. actText .. "\n" .. stageNameText
- writefile("actinfo.txt", fileContent)
- print("Updated actinfo.txt with StageName: " .. stageNameText)
- -- Нажимаем Start
- clickStartButton()
- end
- end
- -- Function to check ResetTime and save Stage/Act before Play
- local function checkResetTime(challengeTemplate)
- local resetTimeLabel = challengeTemplate:FindFirstChild("SideFrame")
- and challengeTemplate.SideFrame:FindFirstChild("ResetTime")
- if resetTimeLabel and resetTimeLabel:IsA("TextLabel") then
- if resetTimeLabel.Text == "Available" then
- print("ResetTime: Available, saving Stage and Act")
- -- Получаем Stage и Act из ChallengeTemplate
- local stageLabel = challengeTemplate:FindFirstChild("ChallengeStage")
- and challengeTemplate.ChallengeStage:FindFirstChild("Stage")
- and challengeTemplate.ChallengeStage.Stage:FindFirstChild("Label")
- local actLabel = challengeTemplate:FindFirstChild("ChallengeStage")
- and challengeTemplate.ChallengeStage:FindFirstChild("Act")
- and challengeTemplate.ChallengeStage.Act:FindFirstChild("Label")
- local stageText = "Not available"
- local actText = "Not available"
- if stageLabel and stageLabel:IsA("TextLabel") then
- stageText = stageLabel.Text
- print("Stage found: " .. stageText)
- else
- print("Stage label not found")
- end
- if actLabel and actLabel:IsA("TextLabel") then
- actText = actLabel.Text
- print("Act found: " .. actText)
- else
- print("Act label not found")
- end
- -- Формируем начальное содержимое файла (без StageName)
- local fileContent = "Act info :\n" .. stageText .. "\n" .. actText .. "\nNot available"
- writefile("actinfo.txt", fileContent)
- print("Saved Stage and Act to actinfo.txt")
- -- Нажимаем Play
- clickPlayButton(challengeTemplate)
- else
- print("ResetTime: ", resetTimeLabel.Text, " (waiting for 'Available')")
- spawn(function()
- while resetTimeLabel and resetTimeLabel.Text ~= "Available" do
- wait(1)
- if not resetTimeLabel or not resetTimeLabel.Parent then break end
- if resetTimeLabel.Text == "Available" then
- print("ResetTime became: Available, saving Stage and Act")
- -- Получаем Stage и Act из ChallengeTemplate
- local stageLabel = challengeTemplate:FindFirstChild("ChallengeStage")
- and challengeTemplate.ChallengeStage:FindFirstChild("Stage")
- and challengeTemplate.ChallengeStage.Stage:FindFirstChild("Label")
- local actLabel = challengeTemplate:FindFirstChild("ChallengeStage")
- and challengeTemplate.ChallengeStage:FindFirstChild("Act")
- and challengeTemplate.ChallengeStage.Act:FindFirstChild("Label")
- local stageText = "Not available"
- local actText = "Not available"
- if stageLabel and stageLabel:IsA("TextLabel") then
- stageText = stageLabel.Text
- print("Stage found: " .. stageText)
- else
- print("Stage label not found")
- end
- if actLabel and actLabel:IsA("TextLabel") then
- actText = actLabel.Text
- print("Act found: " .. actText)
- else
- print("Act label not found")
- end
- -- Формируем начальное содержимое файла (без StageName)
- local fileContent = "Act info :\n" .. stageText .. "\n" .. actText .. "\nNot available"
- writefile("actinfo.txt", fileContent)
- print("Saved Stage and Act to actinfo.txt")
- -- Нажимаем Play
- clickPlayButton(challengeTemplate)
- break
- else
- print("ResetTime: ", resetTimeLabel.Text, " (waiting for 'Available')")
- end
- end
- end)
- end
- end
- end
- -- Function to search for ChallengeTemplate with "Trait Reroll Challenge"
- local function searchChallengeTemplate()
- local challengesList = LocalPlayer.PlayerGui:FindFirstChild("Challenges")
- and LocalPlayer.PlayerGui.Challenges:FindFirstChild("Holder")
- and LocalPlayer.PlayerGui.Challenges.Holder:FindFirstChild("ChallengesList")
- if challengesList then
- for _, child in pairs(challengesList:GetChildren()) do
- if child.Name == "ChallengeTemplate" and child:IsA("Frame") then
- local textLabel = child:FindFirstChildOfClass("TextLabel")
- if textLabel and textLabel:IsA("TextLabel") and textLabel.Text == "Trait Reroll Challenge" then
- checkResetTime(child)
- return
- end
- end
- end
- end
- end
- -- Function to click the Create button with 500ms delay
- local function clickCreateButton()
- local button = LocalPlayer.PlayerGui:FindFirstChild("LobbyInterface")
- and LocalPlayer.PlayerGui.LobbyInterface:FindFirstChild("Holder")
- and LocalPlayer.PlayerGui.LobbyInterface.Holder:FindFirstChild("Buttons")
- and LocalPlayer.PlayerGui.LobbyInterface.Holder.Buttons:FindFirstChild("Create")
- if button and button:IsA("Frame") then
- local clickDetector = button:FindFirstChildOfClass("ClickDetector")
- if clickDetector then
- fireclickdetector(clickDetector)
- else
- local textButton = button:FindFirstChildOfClass("TextButton")
- if textButton then
- local connections = getconnections(textButton.Activated) or getconnections(textButton.MouseButton1Click)
- for _, connection in pairs(connections) do
- connection:Fire()
- end
- else
- local connections = getconnections(button.Activated) or getconnections(button.MouseButton1Click)
- for _, connection in pairs(connections) do
- connection:Fire()
- end
- end
- end
- wait(0.5) -- Задержка 500 мс после нажатия Create
- searchChallengeTemplate()
- end
- end
- -- Function to move to a waypoint
- local function moveToWaypoint(waypoint)
- if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Humanoid") then
- return
- end
- local humanoid = LocalPlayer.Character.Humanoid
- humanoid.WalkSpeed = 30
- humanoid:MoveTo(waypoint)
- local connection
- connection = RunService.Heartbeat:Connect(function()
- if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
- connection:Disconnect()
- return
- end
- local pos = LocalPlayer.Character.HumanoidRootPart.Position
- local distance = (Vector3.new(pos.X, 0, pos.Z) - Vector3.new(waypoint.X, 0, waypoint.Z)).Magnitude
- if distance < 2 or not isMoving then
- connection:Disconnect()
- if isMoving then
- currentWaypointIndex = currentWaypointIndex + 1
- if currentWaypointIndex <= #waypoints then
- moveToWaypoint(waypoints[currentWaypointIndex])
- else
- isMoving = false
- humanoid.WalkSpeed = 16
- wait(1)
- clickCreateButton()
- end
- end
- end
- end)
- end
- -- Stage 1 button functionality (manual click only)
- stage1Button.MouseButton1Click:Connect(function()
- if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Humanoid") then
- return
- end
- isMoving = true
- currentWaypointIndex = 1
- moveToWaypoint(waypoints[currentWaypointIndex])
- end)
Advertisement
Add Comment
Please, Sign In to add comment