Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local player = game.Players.LocalPlayer
- local VirtualInputManager = game:GetService("VirtualInputManager")
- local teleportService = game:GetService("TeleportService")
- local placeId = game.PlaceId -- Automatically gets the current game's Place ID
- local jobId = game.JobId -- Gets the unique ID of the current server
- -- Function to send Roblox notifications
- local function sendNotification(title, text)
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = title;
- Text = text;
- Duration = 2; -- Duration for the notification
- })
- end
- sendNotification("Status", "Loading Character")
- wait(1)
- local kenHakiActivated = false -- Flag to check if Ken Haki is activated
- local soldier -- Variable to store the selected soldier
- -- Function to get a random Military Soldier
- local function getRandomSoldier()
- local militarySoldiers = {}
- local enemiesFolder = workspace:WaitForChild("Enemies")
- for _, enemy in ipairs(enemiesFolder:GetChildren()) do
- if enemy:IsA("Model") and enemy.Name == "Military Soldier" and enemy:FindFirstChild("HumanoidRootPart") then
- table.insert(militarySoldiers, enemy)
- end
- end
- if #militarySoldiers > 0 then
- return militarySoldiers[math.random(1, #militarySoldiers)]
- end
- return nil
- end
- -- Function to tween to the selected soldier
- local function tweenToSoldier(soldier)
- local humanoidRootPart = workspace.Characters[player.Name].HumanoidRootPart
- if soldier and soldier:FindFirstChild("HumanoidRootPart") then
- local targetPosition = soldier.HumanoidRootPart.Position + Vector3.new(0, 3, 0) -- Adjust the height if needed
- local targetCFrame = CFrame.new(targetPosition) -- Create a CFrame for proper orientation
- local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
- local tween = TweenService:Create(humanoidRootPart, tweenInfo, {CFrame = targetCFrame})
- tween:Play()
- tween.Completed:Wait() -- Wait for the tween to complete
- else
- warn("Soldier not found or does not have a HumanoidRootPart.")
- end
- end
- -- Function to simulate pressing the "E" key
- local function pressE()
- sendNotification("Status", "Enabling Ken Haki")
- wait(1)
- VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, game)
- wait(0.1) -- Small delay to simulate key press duration
- VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, game)
- sendNotification("Status", "Ken Haki Enabled")
- wait(0.2)
- sendNotification("Status", "Getting Mob")
- end
- -- Function to rejoin the same server
- local function rejoinServer()
- if jobId ~= "" then
- teleportService:TeleportToPlaceInstance(placeId, jobId)
- else
- warn("Failed to retrieve the current server JobId.")
- end
- end
- -- Function to destroy all Lava parts in the specified location
- local function destroyLavaParts()
- local magma = workspace:FindFirstChild("Map") and workspace.Map:FindFirstChild("Magma")
- if magma then
- for _, model in ipairs(magma:GetChildren()) do
- if model:IsA("Model") then
- for _, part in ipairs(model:GetChildren()) do
- if part:IsA("BasePart") and part.Name == "Lava" then
- part:Destroy()
- end
- end
- end
- end
- else
- warn("Magma folder not found in Map.")
- end
- end
- -- Simulate a click at the specified screen position (288, 152)
- local function simulateClickAtPosition(x, y)
- VirtualInputManager:SendMouseButtonEvent(x, y, 0, true, game, 0) -- Simulate mouse down
- wait(0.1) -- Wait for a short duration to simulate click
- VirtualInputManager:SendMouseButtonEvent(x, y, 0, false, game, 0) -- Simulate mouse up
- sendNotification("Status", "Character Loaded")
- end
- -- Main loop
- while true do
- -- Wait until the character is in the Characters folder
- local characterName = player.Name
- while not workspace.Characters:FindFirstChild(characterName) do
- simulateClickAtPosition(557, 318) -- Click at the position to load character
- sendNotification("Status", "Loading Character Clicking Team") -- Notification for loading character
- wait(1) -- Wait before checking again to avoid spamming clicks
- end
- local humanoid = workspace.Characters[characterName]:WaitForChild("Humanoid") -- Ensure humanoid is available
- local humanoidRootPart = workspace.Characters[characterName]:WaitForChild("HumanoidRootPart") -- Ensure HumanoidRootPart is available
- -- Debug print to check current health
- print("Current Health: ", humanoid.Health)
- if humanoid.Health < 12700 then -- Check if health is under 12k
- warn("Health is below 12000. Rejoining server...")
- rejoinServer() -- Rejoin the server if health is too low
- return -- Exit the loop to prevent further execution
- end
- if not kenHakiActivated then
- wait(2) -- Wait for 2 seconds after the character is loaded
- pressE() -- Simulate pressing "E" to activate Ken Haki
- kenHakiActivated = true -- Set the flag to true after the first press
- wait(2) -- Wait for 2 seconds after pressing "E"
- destroyLavaParts() -- Destroy all parts named "Lava" in specified location
- soldier = getRandomSoldier() -- Get a random soldier
- if soldier then
- tweenToSoldier(soldier) -- Tween to the selected soldier
- else
- warn("No Military Soldiers found.")
- end
- else
- -- Tween to the already selected soldier
- if soldier then
- tweenToSoldier(soldier)
- end
- end
- wait(3) -- Wait before looping again
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement