Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local gui = nil
- local mainFrame = nil
- local closeButton = nil
- -- Function to create the GUI
- local function createGui()
- if gui then gui:Destroy() end
- local ScreenGui = Instance.new("ScreenGui")
- local MainFrame = Instance.new("Frame")
- local CloseButton = Instance.new("TextButton")
- ScreenGui.Name = "PersistentGUI"
- ScreenGui.ResetOnSpawn = false
- ScreenGui.Parent = player.PlayerGui
- CloseButton.Size = UDim2.new(0, 100, 0, 25)
- CloseButton.Position = UDim2.new(0.5, -50, 0, 10)
- CloseButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- CloseButton.Text = "Close"
- CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CloseButton.Font = Enum.Font.SourceSansBold
- CloseButton.TextSize = 14
- CloseButton.Parent = ScreenGui
- CloseButton.ZIndex = 10
- MainFrame.Size = UDim2.new(0.2, 0, 0.6, 0)
- MainFrame.Position = UDim2.new(0.5, -100, 0, 80)
- MainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- MainFrame.BackgroundTransparency = 0.5
- MainFrame.BorderSizePixel = 0
- MainFrame.ClipsDescendants = true
- MainFrame.Visible = true
- MainFrame.ZIndex = 1
- MainFrame.Parent = ScreenGui
- local UIListLayout = Instance.new("UIListLayout")
- UIListLayout.Parent = MainFrame
- UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- UIListLayout.Padding = UDim.new(0, 20)
- UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
- -- Function to create toggle buttons
- local function createToggleButton(number, name, onClick)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0.7, 0, 0, 30)
- button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- button.Text = name
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.Font = Enum.Font.SourceSansBold
- button.TextSize = 14
- button.LayoutOrder = number
- button.Parent = MainFrame
- button.ZIndex = 2
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0.3, 0)
- corner.Parent = button
- -- Load saved state
- local isEnabled = buttonStates[name] or false
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- -- If button was previously enabled, activate it
- if isEnabled then
- onClick(true)
- end
- button.MouseButton1Click:Connect(function()
- isEnabled = not isEnabled
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- buttonStates[name] = isEnabled
- saveButtonStates()
- onClick(isEnabled)
- end)
- return button
- end
- -- Button state saving system
- local HttpService = game:GetService("HttpService")
- local buttonStates = {}
- -- Function to save button states
- local function saveButtonStates()
- local success, err = pcall(function()
- local saveData = HttpService:JSONEncode(buttonStates)
- writefile("buttonStates.json", saveData)
- end)
- end
- -- Function to load button states
- local function loadButtonStates()
- if isfile("buttonStates.json") then
- local success, data = pcall(function()
- return HttpService:JSONDecode(readfile("buttonStates.json"))
- end)
- if success then
- buttonStates = data
- end
- end
- end
- local isEnabled = buttonStates[name] or false
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- -- If button was previously enabled, activate it
- if isEnabled then
- onClick(true)
- end
- button.MouseButton1Click:Connect(function()
- isEnabled = not isEnabled
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- buttonStates[name] = isEnabled
- saveButtonStates()
- onClick(isEnabled)
- end)
- return button
- end
- -- Load saved states when script starts
- loadButtonStates()
- -- Load saved states when script starts
- loadButtonStates()
- -- Kill Aura Function
- local killAuraActive = false
- local killAuraLoop = nil
- local function toggleKillAura(isEnabled)
- killAuraActive = isEnabled
- if isEnabled then
- if not killAuraLoop then
- killAuraLoop = spawn(function()
- while killAuraActive do
- local args = {
- [1] = {
- [1] = {
- ["animationLength"] = 0,
- ["sentAt"] = tick()
- },
- [2] = "G"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
- wait(0)
- end
- end)
- end
- else
- killAuraActive = false
- killAuraLoop = nil
- end
- end
- -- Function to override other GUIs
- local function overrideOtherGUIs()
- local function processGui(gui)
- if gui.Name ~= "PersistentGUI" then -- Don't affect our GUI
- gui.ZIndex = 1 -- Set lower ZIndex
- -- Process all descendants
- for _, desc in ipairs(gui:GetDescendants()) do
- if desc:IsA("GuiObject") then
- desc.ZIndex = 1
- end
- end
- -- Watch for new elements
- gui.DescendantAdded:Connect(function(desc)
- if desc:IsA("GuiObject") then
- desc.ZIndex = 1
- end
- end)
- end
- end
- -- Process existing GUIs
- for _, gui in ipairs(game.Players.LocalPlayer:WaitForChild("PlayerGui"):GetChildren()) do
- processGui(gui)
- end
- -- Watch for new GUIs
- game.Players.LocalPlayer.PlayerGui.ChildAdded:Connect(processGui)
- end
- -- Call the override function
- overrideOtherGUIs()
- - tp
- local function toggleTP(isEnabled)
- tpActive = isEnabled
- if isEnabled then
- if not tpLoop then
- tpLoop = spawn(function()
- while tpActive do
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local Character = LocalPlayer.Character
- local function findNearestNPC()
- local nearestNPC = nil
- local nearestDistance = math.huge
- if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
- for _, folder in ipairs(workspace:GetChildren()) do
- if folder:IsA("Folder") then
- for _, child in ipairs(folder:GetChildren()) do
- if child:FindFirstChild("enemyFolder") then
- for _, npc in ipairs(child.enemyFolder:GetChildren()) do
- if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
- local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
- if distance < nearestDistance then
- nearestDistance = distance
- nearestNPC = npc
- end
- end
- end
- end
- end
- end
- end
- return nearestNPC
- end
- if Character and Character:FindFirstChild("HumanoidRootPart") then
- local targetNPC = findNearestNPC()
- if targetNPC and targetNPC:FindFirstChild("HumanoidRootPart") then
- local npcPosition = targetNPC.HumanoidRootPart.Position
- local offset = Vector3.new(0, 9, 0) -- Changed to 12 studs height
- local targetPosition = npcPosition + offset
- -- Create CFrame that positions above target and looks at them
- local lookAt = CFrame.new(targetPosition, npcPosition)
- Character.HumanoidRootPart.CFrame = lookAt
- end
- end
- wait(0.1) -- Small wait to prevent excessive updates
- end
- end)
- end
- else
- tpActive = false
- tpLoop = nil
- end
- end
- -- Auto-Ability Function
- local abilityActive = false
- local abilityLoop = nil
- local function toggleAbility(isEnabled)
- abilityActive = isEnabled
- if isEnabled then
- if not abilityLoop then
- abilityLoop = spawn(function()
- local VirtualInputManager = game:GetService("VirtualInputManager")
- local lastKeyPress = 0
- local keyPressCooldown = 0.5
- while abilityActive do
- local Character = player.Character
- if Character and Character:FindFirstChild("HumanoidRootPart") then
- local function isNearMobs(range)
- for _, folder in ipairs(workspace:GetChildren()) do
- if folder:IsA("Folder") then
- for _, child in ipairs(folder:GetChildren()) do
- if child:FindFirstChild("enemyFolder") then
- for _, npc in ipairs(child.enemyFolder:GetChildren()) do
- if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
- local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
- if distance <= range then
- return true
- end
- end
- end
- end
- end
- end
- end
- return false
- end
- if isNearMobs(20) and tick() - lastKeyPress >= keyPressCooldown then
- VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, nil)
- task.wait()
- VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, nil)
- VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.Q, false, nil)
- task.wait()
- VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.Q, false, nil)
- lastKeyPress = tick()
- end
- end
- wait(0.1)
- end
- end)
- end
- else
- abilityActive = false
- abilityLoop = nil
- end
- end
- -- Coin-TP Function
- local coinTPActive = false
- local coinTPLoop = nil
- local function toggleCoinTP(isEnabled)
- coinTPActive = isEnabled
- if isEnabled then
- if not coinTPLoop then
- coinTPLoop = spawn(function()
- while coinTPActive do
- local function waitForCoin()
- while not workspace:FindFirstChild("Coin") or not workspace.Coin:FindFirstChild("Coin") do
- wait(2)
- if not coinTPActive then return nil end
- end
- return workspace.Coin.Coin
- end
- local coin = waitForCoin()
- if coin and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local offset = Vector3.new(0, 8, 0)
- for i = 1, 20 do
- if not coinTPActive then break end
- player.Character.HumanoidRootPart.CFrame = CFrame.new(coin.Position + offset)
- wait(0.01)
- end
- end
- wait(0.1)
- end
- end)
- end
- else
- coinTPActive = false
- coinTPLoop = nil
- end
- end
- -- Auto-retry function
- local function toggleAutoRetry(isEnabled)
- if isEnabled then
- -- Create a connection to watch for end of dungeon
- local function checkForEndScreen()
- local frame = game.Players.LocalPlayer.PlayerGui:FindFirstChild("endFrame")
- if frame and frame.Visible then
- wait(1) -- Wait a brief moment
- local args = {
- [1] = {
- [1] = {
- ["\3"] = "vote",
- ["vote"] = true
- },
- [2] = "."
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
- end
- end
- -- Connect to PlayerGui changes
- game.Players.LocalPlayer.PlayerGui.ChildAdded:Connect(function(child)
- if child.Name == "endFrame" then
- checkForEndScreen()
- end
- end)
- -- Check existing GUI in case we're already at end screen
- checkForEndScreen()
- end
- end
- -- Auto Start Function
- local function autoStart()
- game:GetService("ReplicatedStorage").remotes.changeStartValue:FireServer()
- end
- -- Connect to PlayerAdded event
- game.Players.LocalPlayer.CharacterAdded:Connect(function()
- wait(1) -- Wait a short moment to ensure everything is loaded
- autoStart()
- end)
- -- Create all buttons
- createToggleButton(1, "Kill Aura", toggleKillAura)
- createToggleButton(2, "TP", toggleTP)
- createToggleButton(3, "Auto-Ability", toggleAbility)
- createToggleButton(4, "Coin-TP", toggleCoinTP)
- createToggleButton(5, "Auto-Retry", toggleAutoRetry) -- Add this line
- -- Add padding at the top of the frame
- local UIPadding = Instance.new("UIPadding")
- UIPadding.Parent = MainFrame
- UIPadding.PaddingTop = UDim.new(0, 20)
- -- Rounded corners
- local cornerFrame = Instance.new("UICorner")
- cornerFrame.CornerRadius = UDim.new(0.05, 0)
- cornerFrame.Parent = MainFrame
- local cornerButton = Instance.new("UICorner")
- cornerButton.CornerRadius = UDim.new(0.3, 0)
- cornerButton.Parent = CloseButton
- -- Store references
- gui = ScreenGui
- mainFrame = MainFrame
- closeButton = CloseButton
- -- Toggle function
- local function toggleGui()
- MainFrame.Visible = not MainFrame.Visible
- CloseButton.Text = MainFrame.Visible and "Close" or "Open"
- end
- -- Make elements draggable independently
- local function makeDraggable(gui)
- local dragging = false
- local dragStart = nil
- local startPos = nil
- local dragInput = nil
- gui.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = gui.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- gui.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- end)
- end
- makeDraggable(CloseButton)
- makeDraggable(MainFrame)
- CloseButton.MouseButton1Click:Connect(toggleGui)
- end
- -- Button state saving system
- local HttpService = game:GetService("HttpService")
- local buttonStates = {}
- -- Function to save button states
- local function saveButtonStates()
- local success, err = pcall(function()
- local saveData = HttpService:JSONEncode(buttonStates)
- writefile("buttonStates.json", saveData)
- end)
- end
- -- Function to load button states
- local function loadButtonStates()
- if isfile("buttonStates.json") then
- local success, data = pcall(function()
- return HttpService:JSONDecode(readfile("buttonStates.json"))
- end)
- if success then
- buttonStates = data
- end
- end
- end
- -- Modified createToggleButton function (replace the existing one)
- local function createToggleButton(number, name, onClick)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0.7, 0, 0, 30)
- button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- button.Text = name
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.Font = Enum.Font.SourceSansBold
- button.TextSize = 14
- button.LayoutOrder = number
- button.Parent = MainFrame
- button.ZIndex = 2
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0.3, 0)
- corner.Parent = button
- -- Load saved state
- local isEnabled = buttonStates[name] or false
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- -- If button was previously enabled, activate it
- if isEnabled then
- onClick(true)
- end
- button.MouseButton1Click:Connect(function()
- isEnabled = not isEnabled
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- buttonStates[name] = isEnabled
- saveButtonStates()
- onClick(isEnabled)
- end)
- return button
- end
- -- Load saved states when script starts
- loadButtonStates()
- -- Create initial GUI
- createGui()
- -- Handle character respawning
- player.CharacterAdded:Connect(function()
- if not gui or not gui.Parent then
- createGui()
- end
- end)
- -- Handle player removal
- player.AncestryChanged:Connect(function(_, parent)
- if not parent then
- gui:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement