Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Place this script in StarterPlayerScripts or StarterCharacterScripts
- -- List of allowed Place IDs
- local allowedPlaceIds = {
- [14269621394] = true,
- [15297128281] = true
- }
- -- The Place ID to teleport to if the current Place ID is not allowed
- local teleportPlaceId = 15297128281
- local currentPlaceId = game.PlaceId
- if not allowedPlaceIds[currentPlaceId] then
- print("Current Place ID not allowed. Teleporting to Place ID", teleportPlaceId)
- game:GetService("TeleportService"):Teleport(teleportPlaceId)
- return
- end
- -- Function to delete the specified paths
- local function deletePaths()
- local map = workspace:FindFirstChild("Map")
- if map then
- -- Delete Building
- local building = map:FindFirstChild("Building")
- if building then
- building:Destroy()
- print("Building deleted.")
- else
- print("Building not found.")
- end
- -- Delete Fans
- local fans = map:FindFirstChild("Fans")
- if fans then
- fans:Destroy()
- print("Fans deleted.")
- else
- print("Fans not found.")
- end
- -- Delete Banners
- local banners = map:FindFirstChild("Banners")
- if banners then
- banners:Destroy()
- print("Banners deleted.")
- else
- print("Banners not found.")
- end
- -- Delete NeonLights
- local neonLights = map:FindFirstChild("NeonLights")
- if neonLights then
- neonLights:Destroy()
- print("NeonLights deleted.")
- else
- print("NeonLights not found.")
- end
- else
- print("Map not found.")
- end
- end
- -- Call the function to delete the paths only if in the specified Place ID
- if currentPlaceId == 14269621394 then
- deletePaths()
- end
- local player = game.Players.LocalPlayer
- if player.Name ~= _G.PlayerData["Player1"] and player.Name ~= _G.PlayerData["Player2"] then
- print("Not the correct player. Current player:", player.Name)
- return
- end
- local args = {
- [1] = "Change Ready Settings",
- [2] = true
- }
- game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("Main.RE"):FireServer(unpack(args))
- if game.PlaceId == 15297128281 then
- print("In the correct place. Starting MainRE.")
- while true do
- MainRE:FireServer(unpack(args))
- wait(1)
- end
- else
- print("Not in the correct place. Current PlaceId:", game.PlaceId)
- end
- local VirtualUser = game:GetService('VirtualUser')
- local StarterGui = game:GetService('StarterGui')
- StarterGui:SetCore("SendNotification", { Title = "Anti-AFK", Text = "Script Activated", Duration = 5 })
- player.Idled:Connect(function()
- VirtualUser:CaptureController()
- VirtualUser:ClickButton2(Vector2.new())
- end)
- local function disableAFKCheck()
- local function disableScriptInGui(gui)
- local afkCheckScript = gui:FindFirstChild("AFK.Check")
- if afkCheckScript and afkCheckScript:IsA("LocalScript") then
- afkCheckScript.Disabled = true
- print("AFK.Check script in", gui.Name, "is disabled.")
- else
- print("AFK.Check script not found or not a LocalScript in", gui.Name, ".")
- end
- end
- local starterGuiAFKUi = StarterGui:FindFirstChild("AFK.Ui")
- if starterGuiAFKUi then
- disableScriptInGui(starterGuiAFKUi)
- else
- print("AFK.Ui not found in StarterGui.")
- end
- local playerGuiAFKUi = player.PlayerGui:FindFirstChild("AFK.Ui")
- if playerGuiAFKUi then
- disableScriptInGui(playerGuiAFKUi)
- else
- print("AFK.Ui not found in PlayerGui.")
- end
- end
- disableAFKCheck()
- local backpack = player:WaitForChild("Backpack")
- local actionValues = backpack:WaitForChild("ActionValues")
- local power = actionValues:WaitForChild("Power")
- local function onPowerChanged()
- if power.Value >= _G.ChangeValue and _G.Xp and not _G.disableShooting then
- print("Power changed to", power.Value, "- preparing to shoot.")
- local args = {
- [1] = false,
- [2] = "Shooting",
- [3] = "Standing Shot"
- }
- local shotMultiplier = _G.Multiplier
- local playerEvents = backpack:FindFirstChild("PlayerEvents") or ReplicatedStorage:FindFirstChild("PlayerEvents")
- if playerEvents then
- local shootingEvent = playerEvents:FindFirstChild("Shooting")
- if shootingEvent then
- for i = 1, shotMultiplier do
- shootingEvent:FireServer(unpack(args))
- end
- print("Fired", shotMultiplier, "shots.")
- else
- warn("Shooting event not found in PlayerEvents.")
- end
- else
- warn("PlayerEvents folder not found in either Backpack or ReplicatedStorage.")
- end
- end
- end
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local rootPart = character:WaitForChild("HumanoidRootPart")
- -- Define the possible target positions
- local possibleTargetPositions1 = {
- Vector3.new(21, 4, -433),
- Vector3.new(-47, 4, -434),
- Vector3.new(21, 4, -408),
- Vector3.new(-47, 4, -409)
- }
- local possibleTargetPositions2 = {
- Vector3.new(-13, 3, -370),
- Vector3.new(-13, 3, -472)
- }
- -- Function to find the nearest position
- local function getNearestPosition(positions)
- local closestPosition = nil
- local shortestDistance = math.huge
- for _, position in ipairs(positions) do
- local distance = (rootPart.Position - position).magnitude
- if distance < shortestDistance then
- shortestDistance = distance
- closestPosition = position
- end
- end
- return closestPosition
- end
- -- Function to walk to a position
- local function walkToPosition(position)
- humanoid:MoveTo(position)
- humanoid.MoveToFinished:Wait()
- end
- local function mainLoop()
- -- Get the nearest positions
- local targetPosition1 = getNearestPosition(possibleTargetPositions1)
- local targetPosition2 = getNearestPosition(possibleTargetPositions2)
- -- Print the nearest positions for debugging
- print("Nearest Position 1: ", targetPosition1)
- print("Nearest Position 2: ", targetPosition2)
- -- Check if positions are valid
- if not targetPosition1 or not targetPosition2 then
- print("Error: One or both target positions are invalid.")
- return
- end
- wait(18)
- -- Walk to the first target position and shoot
- walkToPosition(targetPosition1)
- wait(6)
- local args1 = {
- [1] = true,
- [2] = "Shooting",
- [3] = "Standing Shot"
- }
- ReplicatedStorage:WaitForChild("PlayerEvents"):WaitForChild("Shooting"):FireServer(unpack(args1))
- -- Wait for 1 second
- wait(1)
- -- Walk to the first target position again and shoot
- walkToPosition(targetPosition1)
- wait(2)
- local args2 = {
- [1] = true,
- [2] = "Shooting",
- [3] = "Standing Shot"
- }
- ReplicatedStorage:WaitForChild("PlayerEvents"):WaitForChild("Shooting"):FireServer(unpack(args2))
- -- Wait for 1 second
- wait(1)
- -- Walk to the first target position a third time and shoot
- walkToPosition(targetPosition1)
- -- Wait for 1 second
- wait(1)
- -- Walk to the second target position
- walkToPosition(targetPosition2)
- print("Reached the target position.")
- wait(2)
- local args4 = {
- [1] = true,
- [2] = "Shooting",
- [3] = "Layup"
- }
- ReplicatedStorage:WaitForChild("PlayerEvents"):WaitForChild("Shooting"):FireServer(unpack(args4))
- print("Reached the target positions and completed the sequence.")
- end
- -- Start the main loop
- mainLoop()
- power:GetPropertyChangedSignal("Value"):Connect(onPowerChanged)
- local function disableShooting()
- _G.Xp = false
- _G.disableShooting = true
- _G.AutoPlay = false
- _G.AutoShoot = false
- print("Shooting and AutoPlay have been disabled as the warm-up is finished.")
- end
- local gameValues = ReplicatedStorage:WaitForChild("GameValues")
- local warmupFinished = gameValues:WaitForChild("WarmupFinished")
- if warmupFinished.Value == true then
- print("Warmup is finished!")
- disableShooting()
- else
- print("Warmup is not finished yet.")
- end
- warmupFinished:GetPropertyChangedSignal("Value"):Connect(function()
- if warmupFinished.Value == true then
- print("Warmup is finished now!")
- disableShooting()
- end
- end)
- -- Ensure the script runs when the player character is added
- local player = game.Players.LocalPlayer
- local function onCharacterAdded(character)
- local humanoid = character:WaitForChild("Humanoid")
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- -- Function to check the Z-coordinate for Team 1
- local function checkZCoordinateTeam1()
- while true do
- local zPos = humanoidRootPart.Position.Z
- if zPos < -421 then
- print("Team 1: Z-coordinate is less than -421. Waiting 25 seconds...")
- wait(25) -- Wait for 25 seconds
- print("Team 1: Moving to (-61, 3, -400)...")
- -- Move the player to (-61, 3, -400) for Team 1
- humanoid:MoveTo(Vector3.new(-61, 3, -400))
- local moveToConnection
- moveToConnection = humanoid.MoveToFinished:Connect(function(reached)
- if reached then
- print("Team 1: Successfully moved to (-61, 3, -400).")
- else
- print("Team 1: Failed to reach position, retrying...")
- humanoid:MoveTo(Vector3.new(-61, 3, -400))
- end
- moveToConnection:Disconnect()
- end)
- end
- wait(0.1) -- Check every 0.1 seconds
- end
- end
- -- Function to check the Z-coordinate for Team 2
- local function checkZCoordinateTeam2()
- while true do
- local zPos = humanoidRootPart.Position.Z
- if zPos > -421 then
- print("Team 2: Z-coordinate is greater than -421. Waiting 25 seconds...")
- wait(25) -- Wait for 25 seconds
- print("Team 2: Moving to (-61, 3, -435)...")
- -- Move the player to (-61, 3, -435) for Team 2
- humanoid:MoveTo(Vector3.new(-61, 3, -435))
- local moveToConnection
- moveToConnection = humanoid.MoveToFinished:Connect(function(reached)
- if reached then
- print("Team 2: Successfully moved to (-61, 3, -435).")
- else
- print("Team 2: Failed to reach position, retrying...")
- humanoid:MoveTo(Vector3.new(-61, 3, -435))
- end
- moveToConnection:Disconnect()
- end)
- end
- wait(0.1) -- Check every 0.1 seconds
- end
- end
- -- Check which team the player is on and run the respective logic
- if player.Team and player.Team.Name == "Team 1" then
- print("You are on Team 1.")
- checkZCoordinateTeam1()
- elseif player.Team and player.Team.Name == "Team 2" then
- print("You are on Team 2.")
- checkZCoordinateTeam2()
- else
- print("You are not on Team 1 or Team 2. Script will not run.")
- end
- end
- -- Connect the function to CharacterAdded
- player.CharacterAdded:Connect(onCharacterAdded)
- -- Handle the case when the character is already loaded
- if player.Character then
- onCharacterAdded(player.Character)
- end
- local placeId = game.PlaceId
- local maxPlayersLimit = _G.ServerPlayers
- if placeId == 15297128281 then
- local function serverHop()
- local HttpService = game:GetService("HttpService")
- local servers = HttpService:JSONDecode(game:HttpGet("https://games.roblox.com/v1/games/" .. placeId .. "/servers/Public?sortOrder=Asc&limit=100")).data
- for _, server in pairs(servers) do
- if server.playing > maxPlayersLimit and server.playing < server.maxPlayers then
- game:GetService("TeleportService"):TeleportToPlaceInstance(placeId, server.id)
- break
- end
- end
- end
- if #game.Players:GetPlayers() <= maxPlayersLimit then
- serverHop()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment