Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Workspace = game:GetService("Workspace")
- local Services = setmetatable({}, {__index = function(Self, Index)
- local NewService = game.GetService(game, Index)
- if NewService then
- Self[Index] = NewService
- end
- return NewService
- end})
- local LocalPlayer = Services.Players.LocalPlayer
- -- Function
- local CustomFunction = {}
- function CustomFunction.ClosestPlayer()
- local ClosestPlayer
- local FarDistance = math.huge
- local Character = LocalPlayer.Character
- if Character then
- local Root = Character:FindFirstChild("HumanoidRootPart")
- if Root then
- for _,Player in pairs(Services.Players.GetPlayers(Services.Players)) do
- if Player ~= LocalPlayer then
- local Character2 = Player.Character
- if Character2 then
- local Root2 = Character2:FindFirstChild("HumanoidRootPart")
- if Root2 then
- local Distance = (Root.Position - Root2.Position).Magnitude
- if Distance < FarDistance then
- FarDistance = Distance
- ClosestPlayer = Player
- end
- end
- end
- end
- end
- end
- end
- return ClosestPlayer
- end
- -- Anti Lags
- task.spawn(function()
- while wait(1) do
- for _,Player in pairs(Services.Players.GetPlayers(Services.Players)) do
- local Character = Player.Character
- if Character then
- local Tool = Character:FindFirstChildOfClass("Tool")
- if Tool then
- local Handle = Tool:FindFirstChild("Handle")
- if Handle then
- local Chroma = Handle:FindFirstChild("Chroma")
- if Chroma then
- Chroma:Destroy()
- end
- end
- end
- local ClonedKnife = Character:FindFirstChild("Handle") or Character:FindFirstChild("ClonedKnife")
- if ClonedKnife then
- local Chroma = ClonedKnife:FindFirstChild("Chroma")
- if Chroma then
- Chroma:Destroy()
- end
- end
- local Dual = Character:FindFirstChild("Dual")
- if Dual then
- local Handle = Dual:FindFirstChild("Handle")
- if Handle then
- local Chroma = Handle:FindFirstChild("Chroma")
- if Chroma then
- Chroma:Destroy()
- end
- end
- end
- end
- end
- local Knives = Workspace:FindFirstChild("Knives")
- if Knives then
- for _,Child in pairs(Knives:GetChildren()) do
- if Child.Name == "Handle" then
- local Chroma = Child:FindFirstChild("Chroma")
- if Chroma then
- Chroma:Destroy()
- end
- end
- end
- end
- end
- end)
- local RawMetatable = getrawmetatable(game)
- local OldNameCall = RawMetatable.__namecall
- setreadonly(RawMetatable, false)
- RawMetatable.__namecall = newcclosure(function(Object, ...)
- local NamecallMethod = getnamecallmethod()
- local Arguments = {...}
- if NamecallMethod == "FireServer" and tostring(Object) == "ShootStart" then
- local Target = CustomFunction.ClosestPlayer()
- if Target then
- local Character = Target.Character
- if Character then
- local Root = Character:FindFirstChild("HumanoidRootPart")
- if Root then
- local Velocity = Root.AssemblyLinearVelocity
- local FinalResult = Root.Position + (Velocity * Vector3.new(1,0,1) * math.random(0.1,0.4)) + Vector3.new(0,Velocity.Y / math.random(10,20),0)
- local Success, Error = pcall(function()
- Arguments[2] = FinalResult
- end)
- end
- end
- end
- warn("Gun Predicted:",tostring(FinalResult))
- elseif NamecallMethod == "FireServer" and tostring(Object) == "FlingKnife" then
- local Target = CustomFunction.ClosestPlayer()
- if Target then
- local Character = LocalPlayer.Character
- local Character2 = Target.Character
- if Character and Character2 then
- local Root = Character:FindFirstChild("HumanoidRootPart")
- local Root2 = Character2:FindFirstChild("HumanoidRootPart")
- if Root and Root2 then
- local Velocity = Root2.AssemblyLinearVelocity * Vector3.new(1,0,1) + Vector3.new(0,Root2.AssemblyLinearVelocity.Y / math.random(10,20),0)
- local Magnitude = (Root.Position - Root2.Position).Magnitude
- local FinalResult = Root2.Position + (Velocity * 0.5) * (Magnitude / 100)
- local Success, Error = pcall(function()
- Arguments[1] = CFrame.new(FinalResult)
- Arguments[2] = FinalResult
- end)
- end
- end
- end
- warn("Knife Predicted:",tostring(FinalResult))
- end
- return OldNameCall(Object, unpack(Arguments))
- end)
- setreadonly(RawMetatable, true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement