Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character
- local localroot = character:WaitForChild("HumanoidRootPart")
- local function closest()
- local range = math.huge
- local target = nil
- for _, v in pairs(game.Players:GetPlayers()) do
- if v ~= player and v.Team ~= player.Team and v.Character then
- local JN = v.Character:FindFirstChild("HumanoidRootPart")
- if JN then
- local dist = (localroot.Position - JN.Position).magnitude
- if dist < range then
- range = dist
- target = JN
- end
- end
- end
- end
- return target
- end
- local t = closest()
- local remote = game:GetService("Players").LocalPlayer.Character.Revolver.RevolverScript.ClientLeftDown
- local mt = getrawmetatable(game)
- setreadonly(mt, false)
- local Old = mt.__namecall
- mt.__namecall = newcclosure(function(self, ...)
- local args = {...}
- local method = getnamecallmethod()
- if self == remote and method:lower() == "fireserver" and t then
- args[1] = t.Position
- return Old(self, unpack(args))
- end
- return Old(self, ...)
- end)
- game:GetService("RunService").Heartbeat:Connect(function()
- t = closest()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement