Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize variables at the top
- local player = game.Players.LocalPlayer
- local gui = nil
- local mainFrame = nil
- local closeButton = nil
- local coinStayDuration = 5
- local saveFilePath = "settings.txt"
- -- Forward declare functions that are used before their definitions
- local createGui
- local makeDraggable
- local loadSettings
- local saveSettings
- -- Function to safely get services and objects
- local function safeGet(parent, path)
- local current = parent
- for _, name in ipairs(path) do
- current = current and current:FindFirstChild(name)
- if not current then return nil end
- end
- return current
- end
- -- Safely get remote events
- local dataRemoteEvent = safeGet(game:GetService("ReplicatedStorage"), {"dataRemoteEvent"})
- local changeStartValueRemote = safeGet(game:GetService("ReplicatedStorage"), {"remotes", "changeStartValue"})
- -- Safely get GUI elements
- local retryVote = safeGet(player.PlayerGui, {"RetryVote"})
- local revivePrompt = safeGet(player.PlayerGui, {"RevivePrompt"})
- local startButton = safeGet(player.PlayerGui, {"HUD", "Mobile", "StartButton"})
- local voteArgs = {
- [1] = {
- [1] = {
- ["\3"] = "vote",
- ["vote"] = true
- },
- [2] = "."
- }
- }
- local reviveArgs = {
- [1] = {
- [1] = {
- ["\3"] = "closeRevive"
- },
- [2] = "\13"
- }
- }
- -- Utility functions
- loadSettings = function()
- local success, data = pcall(function()
- return game:GetService("HttpService"):JSONDecode(readfile(saveFilePath))
- end)
- if success then
- return data
- else
- return {}
- end
- end
- saveSettings = function(settings)
- pcall(function()
- writefile(saveFilePath, game:GetService("HttpService"):JSONEncode(settings))
- end)
- end
- makeDraggable = function(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
- local function findNearestNPC()
- local nearestNPC = nil
- local nearestDistance = math.huge
- local Character = player.Character
- if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
- local dungeon = workspace:FindFirstChild("dungeon")
- if not dungeon then return end
- for _, child in ipairs(dungeon: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
- return nearestNPC
- end
- local function softLockCharacter(character, position)
- if character and character:FindFirstChild("HumanoidRootPart") then
- local connection
- connection = game:GetService("RunService").Heartbeat:Connect(function()
- if character.Parent and character:FindFirstChild("HumanoidRootPart") then
- character.HumanoidRootPart.CFrame = position
- else
- connection:Disconnect()
- end
- end)
- return connection
- end
- end
- local softLockConnection
- local tpActive = false
- local function teleportToNPC()
- if not tpActive then return end
- local Character = player.Character
- if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
- local npc = findNearestNPC()
- if npc and npc:FindFirstChild("HumanoidRootPart") then
- local npcPosition = npc.HumanoidRootPart.Position
- local teleportPosition = Vector3.new(npcPosition.X, npcPosition.Y + 9, npcPosition.Z)
- local lookVector = (npcPosition - teleportPosition).Unit
- local lookCFrame = CFrame.new(teleportPosition, teleportPosition + lookVector)
- Character.HumanoidRootPart.CFrame = lookCFrame
- if softLockConnection then
- softLockConnection:Disconnect()
- end
- softLockConnection = softLockCharacter(Character, lookCFrame)
- end
- end
- local function mainLoop()
- while true do
- teleportToNPC()
- task.wait(2)
- end
- end
- local function setupCharacter(character)
- character:WaitForChild("HumanoidRootPart")
- coroutine.wrap(mainLoop)()
- end
- if player.Character then
- setupCharacter(player.Character)
- end
- player.CharacterAdded:Connect(setupCharacter)
- 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] = "N"
- }
- }
- if dataRemoteEvent then
- dataRemoteEvent:FireServer(unpack(args))
- end
- task.wait()
- end
- end)
- end
- else
- killAuraActive = false
- killAuraLoop = nil
- end
- end
- 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.2
- 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
- local coinTPActive = false
- local coinTPLoop = nil
- local function findNearestCoin()
- local nearestCoin = nil
- local nearestDistance = math.huge
- local Character = player.Character
- if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
- for _, descendant in ipairs(workspace:GetDescendants()) do
- if descendant.Name == "Coin" and descendant:IsA("BasePart") then
- local distance = (Character.HumanoidRootPart.Position - descendant.Position).Magnitude
- if distance < nearestDistance then
- nearestDistance = distance
- nearestCoin = descendant
- end
- end
- end
- return nearestCoin
- end
- local function toggleCoinTP(isEnabled)
- coinTPActive = isEnabled
- if isEnabled then
- if not coinTPLoop then
- coinTPLoop = spawn(function()
- while coinTPActive do
- local coin = findNearestCoin()
- if coin and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local offset = Vector3.new(0, 3, 0)
- player.Character.HumanoidRootPart.CFrame = CFrame.new(coin.Position + offset)
- wait(coinStayDuration) -- Use the coinStayDuration here
- else
- wait(0.5)
- end
- end
- end)
- end
- else
- coinTPActive = false
- if coinTPLoop then
- coinTPLoop:Disconnect()
- coinTPLoop = nil
- end
- end
- end
- local autoRetryActive = false
- local autoRetryLoop = nil
- local function toggleAutoRetry(isEnabled)
- autoRetryActive = isEnabled
- if isEnabled then
- if not autoRetryLoop then
- autoRetryLoop = spawn(function()
- while autoRetryActive do
- 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
- -- Auto Start
- local startButton = player.PlayerGui:FindFirstChild("HUD"):FindFirstChild("Mobile"):FindFirstChild("StartButton")
- if startButton and startButton.Visible then
- wait(1)
- game:GetService("ReplicatedStorage").remotes.changeStartValue:FireServer(true)
- end
- end
- checkForEndScreen()
- wait(1) -- Wait for 1 second before checking again
- end
- end)
- end
- else
- autoRetryActive = false
- if autoRetryLoop then
- autoRetryLoop:Disconnect()
- autoRetryLoop = nil
- end
- end
- end
- local function createGui()
- if gui then
- gui:Destroy()
- end
- local ScreenGui = Instance.new("ScreenGui")
- local MainFrame = Instance.new("Frame")
- local ImageLabel = Instance.new("ImageLabel")
- local CloseButton = Instance.new("TextButton")
- local ButtonContainer = Instance.new("Frame")
- local HeaderLabel = Instance.new("TextLabel")
- -- ScreenGui setup
- ScreenGui.Name = "PersistentGUI"
- ScreenGui.ResetOnSpawn = false
- ScreenGui.DisplayOrder = 999999999
- ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
- -- CloseButton setup
- CloseButton.Size = UDim2.new(0, 150, 0, 45)
- CloseButton.Position = UDim2.new(0.5, -75, 0, -40) -- Changed to center horizontally and moved higher
- CloseButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- CloseButton.BackgroundTransparency = 0.3
- CloseButton.Text = "Open/Close"
- CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CloseButton.Font = Enum.Font.GothamBlack
- CloseButton.TextSize = 16
- CloseButton.Parent = ScreenGui
- CloseButton.ZIndex = 10
- -- Add corner to close button
- local closeCorner = Instance.new("UICorner")
- closeCorner.CornerRadius = UDim.new(0.3, 0)
- closeCorner.Parent = CloseButton
- -- Add stroke to close button
- local closeStroke = Instance.new("UIStroke")
- closeStroke.Color = Color3.fromRGB(255, 255, 255)
- closeStroke.Transparency = 0.8
- closeStroke.Thickness = 1
- closeStroke.Parent = CloseButton
- -- MainFrame setup
- MainFrame.Size = UDim2.new(0.25, 0, 0.6, 0)
- MainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
- MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- MainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- MainFrame.BackgroundTransparency = 0.5
- MainFrame.BorderSizePixel = 0
- MainFrame.ClipsDescendants = true
- MainFrame.Visible = true
- MainFrame.ZIndex = 1
- MainFrame.Parent = ScreenGui
- -- Image setup
- ImageLabel.Size = UDim2.new(1, 0, 0.6, 0)
- ImageLabel.Position = UDim2.new(0, 0, 0, 0)
- ImageLabel.BackgroundTransparency = 1
- ImageLabel.Image = "rbxassetid://83971645462159"
- ImageLabel.ScaleType = Enum.ScaleType.Fit
- ImageLabel.ZIndex = 2
- ImageLabel.Parent = MainFrame
- -- Header setup
- HeaderLabel.Size = UDim2.new(1, 0, 0.1, 0)
- HeaderLabel.Position = UDim2.new(0, 0, 0, 0)
- HeaderLabel.BackgroundTransparency = 1
- HeaderLabel.Text = "Kinayo Ripoff"
- HeaderLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- HeaderLabel.Font = Enum.Font.GothamBold
- HeaderLabel.TextSize = 24
- HeaderLabel.ZIndex = 3
- HeaderLabel.Parent = MainFrame
- -- Button Container setup
- ButtonContainer.Size = UDim2.new(1, 0, 0.45, 0)
- ButtonContainer.Position = UDim2.new(0, 0, 1, 0)
- ButtonContainer.AnchorPoint = Vector2.new(0, 1)
- ButtonContainer.BackgroundTransparency = 1
- ButtonContainer.Parent = MainFrame
- local mainFrameCorner = Instance.new("UICorner")
- mainFrameCorner.CornerRadius = UDim.new(0.05, 0)
- mainFrameCorner.Parent = MainFrame
- -- Grid layout for buttons
- local UIGridLayout = Instance.new("UIGridLayout")
- UIGridLayout.Parent = ButtonContainer
- UIGridLayout.CellSize = UDim2.new(0.48, -1, 0.18, 0)
- UIGridLayout.CellPadding = UDim2.new(0, 2, 0, 2)
- UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
- UIGridLayout.FillDirectionMaxCells = 2
- UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- UIGridLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
- -- Make frames draggable
- makeDraggable(CloseButton)
- makeDraggable(MainFrame)
- local savedSettings = loadSettings()
- local function createToggleButton(number, name, onClick)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, 0, 1, 0)
- button.BackgroundTransparency = 0.1 -- Reduced from 0.3 to make it more white
- button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- button.Text = name
- button.TextColor3 = Color3.fromRGB(0, 0, 0)
- button.Font = Enum.Font.GothamBlack
- button.TextSize = 14
- button.LayoutOrder = number
- button.Parent = ButtonContainer
- button.ZIndex = 2
- -- Add rounder corners to button
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0.3, 0)
- corner.Parent = button
- -- Add stroke to button
- local stroke = Instance.new("UIStroke")
- stroke.Color = Color3.fromRGB(255, 255, 255)
- stroke.Transparency = 0.9
- stroke.Thickness = 1
- stroke.Parent = button
- local isEnabled = savedSettings[name] or false
- local function updateButtonAppearance()
- if isEnabled then
- button.BackgroundColor3 = Color3.fromRGB(86, 71, 201)
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- stroke.Transparency = 0.7
- else
- button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- button.TextColor3 = Color3.fromRGB(0, 0, 0)
- stroke.Transparency = 0.9
- end
- end
- updateButtonAppearance()
- if isEnabled then
- onClick(true)
- end
- button.MouseButton1Click:Connect(function()
- isEnabled = not isEnabled
- updateButtonAppearance()
- onClick(isEnabled)
- savedSettings[name] = isEnabled
- saveSettings(savedSettings)
- end)
- end
- createToggleButton(1, "TP Mob", function(enabled) tpActive = enabled end)
- createToggleButton(2, "Kill Aura", toggleKillAura)
- createToggleButton(3, "Auto Ability", toggleAbility)
- createToggleButton(4, "Coin TP", toggleCoinTP)
- createToggleButton(5, "Auto Retry-Start", toggleAutoRetry)
- CloseButton.MouseButton1Click:Connect(function()
- MainFrame.Visible = not MainFrame.Visible
- end)
- gui = ScreenGui
- mainFrame = MainFrame
- closeButton = CloseButton
- return ScreenGui, MainFrame, CloseButton
- end
- -- Initialize the GUI
- createGui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement