
Key RequiredUniversal

--add us on roblox vincentplayz9356
local npcs = {}
local RunService = game:GetService("RunService")
local interval = 0.04
local lastUpdate = 0
local OrgDestroyHeight = -500
local function disableNPCAbilities(npc)
local humanoid = npc:FindFirstChildOfClass("Humanoid")
local rootPart = npc:FindFirstChild("HumanoidRootPart")
if humanoid then
humanoid.Sit = true
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
humanoid.PlatformStand = true
humanoid.BreakJointsOnDeath = false
humanoid.Health = -math.huge
humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
end
if rootPart then
rootPart.Anchored = true
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
local damageScript = weapon:FindFirstChild("DamageScript")
if damageScript then
damageScript.Disabled = true
end
end
for _, part in ipairs(npc:GetDescendants()) do
if part:IsA("BasePart") then
part.CanTouch = false
end
end
for _, otherNpc in ipairs(npcs) do
local otherRoot = otherNpc:FindFirstChild("HumanoidRootPart")
if otherNpc ~= npc and rootPart and otherRoot then
if (otherRoot.Position - rootPart.Position).Magnitude <= 100 then
humanoid.PlatformStand = true
end
end
end
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)No comments yet for this script.



