
KeylessUniversal

-- add us on roblox vincentplayz9356
local npcs = {}
local RunService = game:GetService("RunService")
local interval = 0.04
local lastUpdate = 0
local OrgDestroyHeight = -500
local function setNoCollision(npc)
for _, part in ipairs(npc:GetDescendants()) do
if part:IsA("BasePart") then
part.CanCollide = false
part.CanTouch = false
end
end
end
local function disableNPCAbilities(npc)
local humanoid = npc:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.JumpPower = 0
humanoid.WalkSpeed = 1000
humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
humanoid.Health = -math.huge
end
local rootPart = npc:FindFirstChild("HumanoidRootPart")
if rootPart then
print(npc.Name .. " is Anchored: " .. tostring(rootPart.Anchored))
end
local attackScript = npc:FindFirstChild("AttackScript")
if attackScript then
attackScript.Disabled = true
end
local weapon = npc:FindFirstChild("Weapon")
if weapon and weapon:IsA("Tool") then
weapon:Destroy()
end
setNoCollision(npc)
end
local function processAllNPCs()
for _, obj in ipairs(workspace:GetDescendants()) do
if obj:IsA("Humanoid") and not game.Players:GetPlayerFromCharacter(obj.Parent) then
local npcRoot = obj.Parent:FindFirstChild("HumanoidRootPart")
if npcRoot then
disableNPCAbilities(obj.Parent)
npcs[npcRoot] = {
humanoid = obj,
lastSafePosition = npcRoot.Position
}
end
end
end
end
processAllNPCs()
workspace.DescendantAdded:Connect(function(obj)
if obj:IsA("Humanoid") and not game.Players:GetPlayerFromCharacter(obj.Parent) then
local npcRoot = obj.Parent:FindFirstChild("HumanoidRootPart")
if npcRoot then
disableNPCAbilities(obj.Parent)
npcs[npcRoot] = {
humanoid = obj,
lastSafePosition = npcRoot.Position
}
end
end
end)
RunService.Heartbeat:Connect(function(deltaTime)
lastUpdate = lastUpdate + deltaTime
if lastUpdate >= interval then
lastUpdate = 0
for root, data in pairs(npcs) do
if root and root.Parent and data.humanoid and data.humanoid.Health > 0 then
local rayOrigin = root.Position
local rayDirection = Vector3.new(0, -20, 0)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {root.Parent}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local rayResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if rayResult and rayResult.Instance then
data.lastSafePosition = root.Position
end
if root.Position.Y <= OrgDestroyHeight + 25 then
root.CFrame = CFrame.new(data.lastSafePosition + Vector3.new(0, 5, 0))
root.Velocity = Vector3.zero
end
end
end
end
end)



the script is good but can you fix it to where i dont have to lag every second