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
- local isEnabled = false
- button.MouseButton1Click:Connect(function()
- isEnabled = not isEnabled
- button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
- 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
- -- TP Function
- local tpActive = false
- local tpLoop = nil
- 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 targetNPC
- local function findNearestNPC()
- local nearestNPC = nil
- local nearestDistance = math.huge
- if not Character or not Character.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
- targetNPC = findNearestNPC()
- if Character and Character:FindFirstChild("HumanoidRootPart") and targetNPC and targetNPC:FindFirstChild("HumanoidRootPart") then
- local npcPosition = targetNPC.HumanoidRootPart.Position
- local offset = Vector3.new(0, 9, 0)
- local cframe = CFrame.new(npcPosition + offset, npcPosition)
- Character.HumanoidRootPart.CFrame = cframe
- end
- wait(0.5)
- 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
- -- Create all buttons
- createToggleButton(1, "Kill Aura", toggleKillAura)
- createToggleButton(2, "TP", toggleTP)
- createToggleButton(3, "Auto-Ability", toggleAbility)
- createToggleButton(4, "Coin-TP", toggleCoinTP)
- -- 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
- -- 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