This script will kill all NPC's currently loaded that have the TargetName YOU MUST input it yourself at the top of the script before executing.
If you plan on using any part of this code I require some form of credits.
Information for other scripters:
The function GetSessionID is probably the biggest achievement of this code
it allows you to validate the RegisterAttack calls and obviously you could intercept
the remote but this function can get it at any time without having to wait for remote
or do anything else really.
1local TargetName = "Snowman" -- Put target NPC name here. (Just look at their name tag and copy exactly.)
2
3local RunService = game:GetService("RunService")
4local ReplicatedStorage = game:GetService("ReplicatedStorage")
5local Net = ReplicatedStorage.Modules.Net
6local RegisterAttack = Net["RE/RegisterAttack"]
7local RegisterHit = Net["RE/RegisterHit"]
8
9local Players = game:GetService("Players")
10local LocalPlayer = Players.LocalPlayer
11local function GetCharacter()
12 return LocalPlayer.Character or (LocalPlayer.CharacterAdded:wait() and LocalPlayer.Character)
13end
14
15local function GetSessionID()
16 -- Get Combat Thread
17 local SendHitsToServer = getrenv()._G.SendHitsToServer
18 local CombatThread = getupvalues(SendHitsToServer)[1]
19 -- Construct Session ID
20 local UserIDSlice = tostring(LocalPlayer.UserId):sub(2, 4)
21 local MemorySlice = tostring(CombatThread):sub(11, 15)
22 -- Combine The Two Parts
23 local SessionID = UserIDSlice .. MemorySlice
24
25 return SessionID
26end
27print("Session ID Test:", GetSessionID())
28
29local function Attack(TargetCharacter)
30 RegisterAttack:FireServer(0.5)
31 task.wait()
32 local dataTable = {
33 TargetCharacter:WaitForChild("RightLowerLeg"),
34 {},
35 nil,
36 GetSessionID()
37 }
38 RegisterHit:FireServer(unpack(dataTable))
39end
40local Enemies = workspace.Enemies
41
42local RootPart = GetCharacter():WaitForChild("HumanoidRootPart")
43
44while task.wait() do
45 for i, Enemy in pairs(Enemies:GetChildren()) do
46 if Enemy.Name == TargetName and Enemy:FindFirstChild("Humanoid") and Enemy.Humanoid.Health > 0 then
47 local TargetRootPart = Enemy:FindFirstChild("HumanoidRootPart")
48 if TargetRootPart then
49 repeat task.wait()
50 RootPart.CFrame = CFrame.new(TargetRootPart.Position) * CFrame.new(0, 57, 0)
51 RootPart.Velocity = Vector3.zero
52 task.wait()
53 Attack(Enemy)
54 until Enemy.Humanoid.Health == 0
55 end
56 end
57 end
58end