local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local RunService = game:GetService("RunService") local Debris = game:GetService("Debris") local player = Players.LocalPlayer ------------------------------------------------ -- CHARACTER ------------------------------------------------ local character = player.Character or player.CharacterAdded:Wait() local root = character:WaitForChild("HumanoidRootPart") player.CharacterAdded:Connect(function(char) character = char root = char:WaitForChild("HumanoidRootPart") end) ------------------------------------------------ -- SETTINGS ------------------------------------------------ local ENABLED = true local RANGE = 5 local COOLDOWN = 0.8 local lastHit = {} ------------------------------------------------ -- GUI ------------------------------------------------ local gui = Instance.new("ScreenGui") gui.Name = "AntiBatShield" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 300, 0, 140) frame.Position = UDim2.new(0.5, -150, 0.5, -70) frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) frame.BackgroundTransparency = 0.2 frame.Parent = gui Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 40) title.BackgroundTransparency = 1 title.Text = "ANTI BAT SHIELD" title.Font = Enum.Font.GothamBold title.TextSize = 18 title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Parent = frame local toggle = Instance.new("TextButton") toggle.Size = UDim2.new(0.8, 0, 0, 40) toggle.Position = UDim2.new(0.1, 0, 0.5, 0) toggle.Text = "Enabled" toggle.Font = Enum.Font.GothamBold toggle.TextSize = 16 toggle.BackgroundColor3 = Color3.fromRGB(0, 170, 255) toggle.TextColor3 = Color3.new(1,1,1) toggle.Parent = frame Instance.new("UICorner", toggle).CornerRadius = UDim.new(0, 8) toggle.MouseButton1Click:Connect(function() ENABLED = not ENABLED toggle.Text = ENABLED and "Enabled" or "Disabled" toggle.BackgroundColor3 = ENABLED and Color3.fromRGB(0,170,255) or Color3.fromRGB(80,80,80) end) ------------------------------------------------ -- KNOCKBACK FUNCTION ------------------------------------------------ local function knockback(enemyRoot) local dir = (enemyRoot.Position - root.Position).Unit local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e8, 1e8, 1e8) bv.Velocity = (dir * 90) + Vector3.new(0, 55, 0) bv.Parent = enemyRoot Debris:AddItem(bv, 0.2) end ------------------------------------------------ -- ANTI BAT SYSTEM ------------------------------------------------ RunService.RenderStepped:Connect(function() if not ENABLED then return end if not root then return end for _, plr in ipairs(Players:GetPlayers()) do if plr ~= player and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then local enemyRoot = plr.Character.HumanoidRootPart local dist = (enemyRoot.Position - root.Position).Magnitude if dist <= RANGE then if not lastHit[plr] or tick() - lastHit[plr] > COOLDOWN then lastHit[plr] = tick() knockback(enemyRoot) end end end end end)