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
- -- Save file path (relative to the exploit's workspace)
- local saveFilePath = "settings.txt"
- -- Function to load settings from the save file
- local function loadSettings()
- local success, data = pcall(function()
- return game:GetService("HttpService"):JSONDecode(readfile(saveFilePath))
- end)
- if success then
- return data
- else
- return {}
- end
- end
- -- Function to save settings to the save file
- local function saveSettings(settings)
- local success, _ = pcall(function()
- writefile(saveFilePath, game:GetService("HttpService"):JSONEncode(settings))
- end)
- end
- -- Function to make an object draggable
- local function makeDraggable(object)
- local UserInputService = game:GetService("UserInputService")
- local dragging
- local dragInput
- local dragStart
- local startPos
- local function update(input)
- local delta = input.Position - dragStart
- object.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- object.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = object.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- object.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- end
- -- 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.DisplayOrder = 999999999
- ScreenGui.Parent = player.PlayerGui
- CloseButton.Size = UDim2.new(0, 150, 0, 50)
- CloseButton.Position = UDim2.new(0.5, -75, 0, 10)
- CloseButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- CloseButton.Text = "Open/Close"
- CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CloseButton.Font = Enum.Font.SourceSansBold
- CloseButton.TextSize = 18
- CloseButton.Parent = ScreenGui
- CloseButton.ZIndex = 10
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0.5, 0)
- corner.Parent = CloseButton
- MainFrame.Size = UDim2.new(0.3, 0, 0.5, 0)
- MainFrame.Position = UDim2.new(0.5, -150, 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 UIGridLayout = Instance.new("UIGridLayout")
- UIGridLayout.Parent = MainFrame
- UIGridLayout.CellSize = UDim2.new(0.45, 0, 0, 30)
- UIGridLayout.CellPadding = UDim2.new(0.05, 0, 0.05, 0)
- UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
- UIGridLayout.FillDirectionMaxCells = 2
- local frameCorner = Instance.new("UICorner")
- frameCorner.CornerRadius = UDim.new(0.05, 0)
- frameCorner.Parent = MainFrame
- -- Make CloseButton and MainFrame draggable
- makeDraggable(CloseButton)
- makeDraggable(MainFrame)
- -- Load saved settings
- local savedSettings = loadSettings()
- -- Function to create toggle buttons
- local function createToggleButton(number, name, onClick)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, 0, 1, 0)
- 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
- local isEnabled = savedSettings[name] or false
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- 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)
- savedSettings[name] = isEnabled
- saveSettings(savedSettings)
- onClick(isEnabled)
- end)
- return button
- end
- -- 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
- -- New TP Function
- local tpActive = false
- local tpLoop = nil
- local LocalPlayer = game.Players.LocalPlayer
- local Character = LocalPlayer.Character
- local targetNPC = nil
- local targetCoin = nil
- local coinTouchedTime = 0
- local coinStayDuration = 1
- local waitTimeIfNoMobs = 1
- local delay = 2
- local offset = Vector3.new(0, 9, 0)
- local function freezeCharacters()
- for _, player in pairs(game.Players:GetPlayers()) do
- if player.Character and player.Character:FindFirstChild('Humanoid') then
- player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Frozen)
- end
- end
- end
- local function unfreezeCharacters()
- for _, player in pairs(game.Players:GetPlayers()) do
- if player.Character and player.Character:FindFirstChild('Humanoid') then
- player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
- end
- end
- end
- local function findNearestNPC()
- local nearestNPC = nil
- local nearestDistance = math.huge
- Character = LocalPlayer.Character
- 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
- local function findNearestCoin()
- if workspace:FindFirstChild("Coin") and workspace.Coin:FindFirstChild("Coin") then
- return workspace.Coin.Coin
- end
- return nil
- end
- local function stayOnTopOfTarget()
- if targetCoin and targetCoin.Parent then
- if Character and Character:FindFirstChild("HumanoidRootPart") then
- Character.HumanoidRootPart.CFrame = targetCoin.CFrame
- if coinTouchedTime == 0 then
- coinTouchedTime = tick()
- end
- if tick() - coinTouchedTime > coinStayDuration then
- targetCoin = nil
- coinTouchedTime = 0
- end
- end
- elseif not targetNPC or not targetNPC.Parent or not targetNPC:FindFirstChild("HumanoidRootPart") then
- targetNPC = findNearestNPC()
- if not targetNPC then
- wait(waitTimeIfNoMobs)
- return
- end
- elseif Character and Character:FindFirstChild("HumanoidRootPart") and targetNPC and targetNPC:FindFirstChild("HumanoidRootPart") then
- local npcPosition = targetNPC.HumanoidRootPart.Position
- local lookVector = (npcPosition - Character.HumanoidRootPart.Position).Unit
- local cframe = CFrame.new(npcPosition + offset, npcPosition)
- Character.HumanoidRootPart.CFrame = cframe
- end
- end
- local function toggleTP(isEnabled)
- tpActive = isEnabled
- if isEnabled then
- freezeCharacters()
- if not tpLoop then
- tpLoop = spawn(function()
- local lastTeleportTime = 0
- while tpActive do
- stayOnTopOfTarget()
- local currentTime = tick()
- if currentTime - lastTeleportTime >= delay then
- lastTeleportTime = currentTime
- targetCoin = findNearestCoin()
- if not targetCoin then
- targetNPC = findNearestNPC()
- end
- end
- wait(0.1)
- end
- unfreezeCharacters()
- end)
- end
- else
- tpActive = false
- tpLoop = nil
- unfreezeCharacters()
- 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
- -- Auto-retry function
- local autoRetryActive = false
- local function toggleAutoRetry(isEnabled)
- autoRetryActive = isEnabled
- if isEnabled then
- local function checkForEndScreen()
- local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
- local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
- if retryVote and retryVote.Enabled then
- wait(1)
- local voteArgs = {
- [1] = {
- [1] = {
- ["\3"] = "vote",
- ["vote"] = true
- },
- [2] = "."
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
- elseif revivePrompt and revivePrompt.Enabled then
- wait(1)
- local reviveArgs = {
- [1] = {
- [1] = {
- ["\3"] = "closeRevive"
- },
- [2] = "\13"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
- end
- end
- player.PlayerGui.ChildAdded:Connect(function(child)
- if autoRetryActive and (child.Name == "RetryVote" or child.Name == "RevivePrompt") then
- checkForEndScreen()
- end
- end)
- checkForEndScreen()
- end
- end
- -- Auto-Play Function
- local function toggleAutoPlay(isEnabled)
- if isEnabled then
- local function autoPlay()
- wait(4)
- local args = {
- [1] = {
- [1] = {
- [1] = "\1"
- },
- [2] = "2"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
- end
- if game.Players.LocalPlayer.Character then
- autoPlay()
- end
- game.Players.LocalPlayer.CharacterAdded:Connect(autoPlay)
- else
- for _, connection in pairs(getconnections(game.Players.LocalPlayer.CharacterAdded)) do
- if connection.Function and tostring(connection.Function):find("autoPlay") then
- connection:Disconnect()
- end
- end
- end
- end
- -- Auto-Character Function
- local function toggleAutoCharacter(isEnabled)
- if isEnabled then
- local function autoCharacter()
- wait(7)
- local args = {
- [1] = {
- [1] = {
- [1] = "\1",
- [2] = {
- ["\3"] = "select",
- ["charact"] = 1
- }
- },
- [2] = "2"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
- end
- if game.Players.LocalPlayer.Character then
- autoCharacter()
- end
- game.Players.LocalPlayer.CharacterAdded:Connect(autoCharacter)
- else
- for _, connection in pairs(getconnections(game.Players.LocalPlayer.CharacterAdded)) do
- if connection.Function and tostring(connection.Function):find("autoCharacter") then
- connection:Disconnect()
- end
- end
- end
- end
- -- Create toggle 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)
- createToggleButton(6, "Auto Play", toggleAutoPlay)
- createToggleButton(7, "Auto Character", toggleAutoCharacter)
- -- Toggle GUI visibility
- CloseButton.MouseButton1Click:Connect(function()
- MainFrame.Visible = not MainFrame.Visible
- CloseButton.Text = MainFrame.Visible and "Close" or "Open"
- end)
- gui = ScreenGui
- mainFrame = MainFrame
- closeButton = CloseButton
- end
- -- Create the initial GUI
- createGui()
- -- Recreate GUI when player rejoins
- game.Players.PlayerRemoving:Connect(function(plr)
- if plr == player then
- saveSettings(loadSettings())
- end
- end)
- game.Players.PlayerAdded:Connect(function(plr)
- if plr == player then
- wait(1)
- createGui()
- end
- end)
- -- Initialize
- local targetCoin = findNearestCoin()
- if not targetCoin then
- targetNPC = findNearestNPC()
- end
- -- Main Heartbeat loop
- local lastTeleportTime = 0
- game:GetService("RunService").Heartbeat:Connect(function()
- if tpActive then
- stayOnTopOfTarget()
- local currentTime = tick()
- if currentTime - lastTeleportTime >= delay then
- lastTeleportTime = currentTime
- targetCoin = findNearestCoin()
- if not targetCoin then
- targetNPC = findNearestNPC()
- end
- end
- end
- -- Fire remote events based on GUI state
- local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
- local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
- local startButton = player.PlayerGui:WaitForChild("HUD"):WaitForChild("Mobile"):WaitForChild("StartButton")
- if retryVote and retryVote.Enabled and autoRetryActive then
- local voteArgs = {
- [1] = {
- [1] = {
- ["\3"] = "vote",
- ["vote"] = true
- },
- [2] = "."
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
- end
- if revivePrompt and revivePrompt.Enabled and autoRetryActive then
- local reviveArgs = {
- [1] = {
- [1] = {
- ["\3"] = "closeRevive"
- },
- [2] = "\13"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
- end
- -- Fire changeStartValue if StartButton is visible
- local function checkStartButton()
- local HUD = player.PlayerGui:WaitForChild("HUD", 10)
- if HUD then
- local Mobile = HUD:WaitForChild("Mobile", 5)
- if Mobile then
- local StartButton = Mobile:WaitForChild("StartButton", 2)
- if StartButton and StartButton.Visible then
- game:GetService("ReplicatedStorage").remotes.changeStartValue:FireServer()
- end
- end
- end
- end
- -- Add this function to the main Heartbeat loop
- game:GetService("RunService").Heartbeat:Connect(function()
- if tpActive then
- stayOnTopOfTarget()
- local currentTime = tick()
- if currentTime - lastTeleportTime >= delay then
- lastTeleportTime = currentTime
- targetCoin = findNearestCoin()
- if not targetCoin then
- targetNPC = findNearestNPC()
- end
- end
- end
- -- Fire remote events based on GUI state
- local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
- local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
- if retryVote and retryVote.Enabled and autoRetryActive then
- local voteArgs = {
- [1] = {
- [1] = {
- ["\3"] = "vote",
- ["vote"] = true
- },
- [2] = "."
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
- end
- if revivePrompt and revivePrompt.Enabled and autoRetryActive then
- local reviveArgs = {
- [1] = {
- [1] = {
- ["\3"] = "closeRevive"
- },
- [2] = "\13"
- }
- }
- game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
- end
- -- Check and fire changeStartValue if StartButton is visible
- checkStartButton()
- end)
- end
- -- Create the initial GUI
- createGui()
- -- Recreate GUI when player rejoins
- game.Players.PlayerRemoving:Connect(function(plr)
- if plr == player then
- saveSettings(loadSettings())
- end
- end)
- game.Players.PlayerAdded:Connect(function(plr)
- if plr == player then
- wait(1)
- createGui()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement