-- LAG SERVER - AUTO (Target bor bo'lsa ishlaydi) local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local LocalPlayer = Players.LocalPlayer local LagServer = { loopThread = nil, running = false } function LagServer:GetCurrentCharacter() local ok, res = pcall(function() return LocalPlayer.Data.Character.Value end) if ok and res then return res end local char = LocalPlayer.Character local hum = char and char:FindFirstChildOfClass("Humanoid") return hum and hum:GetAttribute("CharacterName") or "Unknown" end function LagServer:HasAbility4(characterName) local ok, res = pcall(function() local chars = ReplicatedStorage:WaitForChild("Characters") local folder = chars:FindFirstChild(characterName) local ab = folder and folder:FindFirstChild("Abilities") return ab and ab:FindFirstChild("4") ~= nil end) return ok and res end function LagServer:FindNearestPlayer() local char = LocalPlayer.Character local hrp = char and char:FindFirstChild("HumanoidRootPart") if not hrp then return nil end local nearest, dist = nil, math.huge for _,p in pairs(Players:GetPlayers()) do if p ~= LocalPlayer and p.Character then local tr = p.Character:FindFirstChild("HumanoidRootPart") local th = p.Character:FindFirstChild("Humanoid") if tr and th then local hp = th:GetAttribute("Health") if hp and hp > 0 then local d = (hrp.Position - tr.Position).Magnitude if d < dist then dist = d nearest = p end end end end end return nearest end function LagServer:UseAbility4() local charName = self:GetCurrentCharacter() if not self:HasAbility4(charName) then return end local target = self:FindNearestPlayer() if not target then return end local targetChar = target.Character local targetCF = targetChar and targetChar:FindFirstChild("HumanoidRootPart") and targetChar.HumanoidRootPart.CFrame or CFrame.new() pcall(function() local ability = ReplicatedStorage.Characters[charName].Abilities["4"] ReplicatedStorage.Remotes.Abilities.Ability:FireServer(ability, 9000000) local actions = {377,380,383,384,385,387,389} for i=1,7 do local args = { ability, charName..":Abilities:4", i, 9000000, { HitboxCFrames = {targetCF,targetCF}, BestHitCharacter = targetChar, HitCharacters = {targetChar}, Ignore = i>2 and {ActionNumber1={targetChar}} or {}, DeathInfo = {}, BlockedCharacters = {}, HitInfo = { IsFacing = not (i==1 or i==2), IsInFront = i<=2, Blocked = i>2 and false or nil }, ServerTime = tick(), Actions = i>2 and {ActionNumber1={}} or {}, FromCFrame = targetCF }, "Action"..actions[i], i==2 and 0.1 or nil } if i==7 then args[5].RockCFrame = targetCF args[5].Actions = { ActionNumber1 = { [target.Name] = { StartCFrameStr = tostring(targetCF.X)..","..tostring(targetCF.Y)..","..tostring(targetCF.Z)..",0,0,0,0,0,0,0,0,0", ImpulseVelocity = Vector3.new(1901,-25000,291), AbilityName = "4", RotVelocityStr = "0,0,0", VelocityStr = "1.900635,0.010867,0.291061", Duration = 2, RotImpulseVelocity = Vector3.new(5868,-6649,-7414), Seed = math.random(1,1e6), LookVectorStr = "0.988493,0,0.151268" } } } end ReplicatedStorage.Remotes.Combat.Action:FireServer(unpack(args)) end end) end function LagServer:Start() if self.loopThread then return end self.running = true self.loopThread = task.spawn(function() while self.running do local target = self:FindNearestPlayer() if target then self:UseAbility4() pcall(function() local c = self:GetCurrentCharacter() ReplicatedStorage.Remotes.Abilities.AbilityCanceled:FireServer( ReplicatedStorage.Characters[c].Abilities["4"] ) end) task.wait(0.01) else task.wait(0.5) end end self.loopThread = nil end) end function LagServer:Stop() self.running = false if self.loopThread then task.cancel(self.loopThread) self.loopThread = nil end end local MobRemote = ReplicatedStorage:FindFirstChild("Remotes") and ReplicatedStorage.Remotes:FindFirstChild("Character") and ReplicatedStorage.Remotes.Character:FindFirstChild("ChangeCharacter") local mob = LocalPlayer.Data.Character.Value if mob ~= "Mob" and MobRemote then MobRemote:FireServer("Mob") task.wait() end LagServer:Start()