KiilmYk

Ninja legends 2 kill script

Nov 21st, 2024 (edited)
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. -- Teleport, Attack, and Server Hop Script for Ninja Legends 2
  2.  
  3. -- Define the player
  4. local player = game.Players.LocalPlayer
  5. local character = player.Character or player.CharacterAdded:Wait()
  6. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  7.  
  8. -- Get the sword tool (first tool in inventory or equipped)
  9. local sword = player.Backpack:FindFirstChildOfClass("Tool") or character:FindFirstChildOfClass("Tool")
  10. if not sword then
  11. print("No sword found!")
  12. return
  13. end
  14.  
  15. -- Function to teleport above players
  16. local function teleportAbovePlayer(targetPlayer)
  17. if targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
  18. local targetHRP = targetPlayer.Character.HumanoidRootPart
  19. humanoidRootPart.CFrame = targetHRP.CFrame + Vector3.new(0, 100, 0)
  20. wait(0.5)
  21. humanoidRootPart.CFrame = targetHRP.CFrame
  22. end
  23. end
  24.  
  25. -- Function to spam attacks with the sword
  26. local function spamAttackWithSword()
  27. if sword.Parent == player.Backpack then
  28. sword.Parent = character -- Equip the sword
  29. end
  30. -- Spam sword activation for a short time
  31. for _ = 1, 10 do
  32. sword:Activate()
  33. wait(0.1)
  34. end
  35. end
  36.  
  37. -- Function to server hop to the biggest server
  38. local function serverHopToBiggest()
  39. local HttpService = game:GetService("HttpService")
  40. local TeleportService = game:GetService("TeleportService")
  41. local placeId = game.PlaceId
  42.  
  43. -- Fetch a list of servers
  44. local success, servers = pcall(function()
  45. local url = "https://games.roblox.com/v1/games/" .. placeId .. "/servers/Public?sortOrder=Desc&limit=100"
  46. return HttpService:JSONDecode(game:HttpGet(url))
  47. end)
  48.  
  49. if success and servers.data then
  50. -- Sort servers by player count in descending order
  51. table.sort(servers.data, function(a, b)
  52. return a.playing > b.playing
  53. end)
  54.  
  55. -- Join the largest server that isn't the current one
  56. for _, server in ipairs(servers.data) do
  57. if server.playing < server.maxPlayers and server.id ~= game.JobId then
  58. TeleportService:TeleportToPlaceInstance(placeId, server.id)
  59. return
  60. end
  61. end
  62. end
  63.  
  64. print("No suitable servers found for hopping.")
  65. end
  66.  
  67. -- Main loop to target all players
  68. for _, targetPlayer in ipairs(game.Players:GetPlayers()) do
  69. if targetPlayer ~= player then
  70. teleportAbovePlayer(targetPlayer)
  71. spamAttackWithSword()
  72. end
  73. end
  74.  
  75. -- Server hop to the largest available server after targeting all players
  76. serverHopToBiggest()
  77.  
Advertisement
Add Comment
Please, Sign In to add comment