Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Teleport, Attack, and Server Hop Script for Ninja Legends 2
- -- Define the player
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- -- Get the sword tool (first tool in inventory or equipped)
- local sword = player.Backpack:FindFirstChildOfClass("Tool") or character:FindFirstChildOfClass("Tool")
- if not sword then
- print("No sword found!")
- return
- end
- -- Function to teleport above players
- local function teleportAbovePlayer(targetPlayer)
- if targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
- local targetHRP = targetPlayer.Character.HumanoidRootPart
- humanoidRootPart.CFrame = targetHRP.CFrame + Vector3.new(0, 100, 0)
- wait(0.5)
- humanoidRootPart.CFrame = targetHRP.CFrame
- end
- end
- -- Function to spam attacks with the sword
- local function spamAttackWithSword()
- if sword.Parent == player.Backpack then
- sword.Parent = character -- Equip the sword
- end
- -- Spam sword activation for a short time
- for _ = 1, 10 do
- sword:Activate()
- wait(0.1)
- end
- end
- -- Function to server hop to the biggest server
- local function serverHopToBiggest()
- local HttpService = game:GetService("HttpService")
- local TeleportService = game:GetService("TeleportService")
- local placeId = game.PlaceId
- -- Fetch a list of servers
- local success, servers = pcall(function()
- local url = "https://games.roblox.com/v1/games/" .. placeId .. "/servers/Public?sortOrder=Desc&limit=100"
- return HttpService:JSONDecode(game:HttpGet(url))
- end)
- if success and servers.data then
- -- Sort servers by player count in descending order
- table.sort(servers.data, function(a, b)
- return a.playing > b.playing
- end)
- -- Join the largest server that isn't the current one
- for _, server in ipairs(servers.data) do
- if server.playing < server.maxPlayers and server.id ~= game.JobId then
- TeleportService:TeleportToPlaceInstance(placeId, server.id)
- return
- end
- end
- end
- print("No suitable servers found for hopping.")
- end
- -- Main loop to target all players
- for _, targetPlayer in ipairs(game.Players:GetPlayers()) do
- if targetPlayer ~= player then
- teleportAbovePlayer(targetPlayer)
- spamAttackWithSword()
- end
- end
- -- Server hop to the largest available server after targeting all players
- serverHopToBiggest()
Advertisement
Add Comment
Please, Sign In to add comment