Npc AI
local CollectionService = game:GetService("CollectionService")
local step = game:GetService("RunService").Stepped
-- Function to check if a model has a child named "Humanoid" and tagged as "MinutemanAK"
local function hasMinutemanAK(model)
local humanoid = model:FindFirstChildOfClass("Humanoid")
if humanoid and CollectionService:HasTag(humanoid, "MinutemanAK") then
return true
end
return false
end
-- Function to apply the NPC AI script to the model
local function applyNPCScript(model)
--npc ai made by Rufus14
--animations are made with :lerp() and sine waves
--you can convert the model to use it in script builder
local npc = model
local torso = npc.Torso
local head = npc.Head
local leftarm = npc["Left Arm"]
local rightarm = npc["Right Arm"]
local leftleg = npc["Left Leg"]
local rightleg = npc["Right Leg"]
local npchumanoid = npc.Humanoid
local aksound = npc["AK-47"].shoot
--Motor6D's
local neck = torso.Neck
neck.C1 = CFrame.new(0,0,0)
local leftshoulder = torso["Left Shoulder"]
leftshoulder.C1 = CFrame.new(0,0,0)
local rightshoulder = torso["Right Shoulder"]
rightshoulder.C1 = CFrame.new(0,0,0)
local lefthip = torso["Left Hip"]
lefthip.C1 = CFrame.new(0,0,0)
local righthip = torso["Right Hip"]
righthip.C1 = CFrame.new(0,0,0)
local root = npc.HumanoidRootPart.RootJoint
root.C1 = CFrame.new(0,0,0)
--
local sight = 120
local walking = false
local shooting = false
local canshoot = true
local cansay = true
local escaping = false
local saycooldown = 0
local akweld = Instance.new("Weld", npc["AK-47"])
akweld.Part0 = rightarm
akweld.Part1 = npc["AK-47"]
local function walkanim(walkspeed)
if walkspeed > 5 then
walking = true
else
walking = false
end
end
npchumanoid.Running:connect(walkanim)
local function randomwalk()
while wait(math.random(3,6)) do
if not shooting and not walking then
npchumanoid.WalkSpeed = 16
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(math.random(-60,60),math.random(-30,30),math.random(-60,60))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 and not escaping do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
end
end
local function checkandshoot()
while wait() do
saycooldown = saycooldown + 1
if saycooldown == 500 then
cansay = true
saycooldown = 0
end
local closestdistance = math.huge
local closestcharacter = nil
for i,v in pairs(workspace:GetChildren()) do
if v.ClassName == "Model" and v.Name ~= "Rufus14" then
local victimhumanoid = v:findFirstChildOfClass("Humanoid")
local victimhead = v:findFirstChild("Head")
if victimhumanoid and victimhead and v.Name ~= npc.Name then
if victimhumanoid.Health > 0 then
if (victimhead.Position - head.Position).magnitude < sight then
if (victimhead.Position - head.Position).magnitude < closestdistance then
closestdistance = (victimhead.Position - head.Position).magnitude
closestcharacter = v
end
end
end
end
end
end
if closestcharacter ~= nil then
local victimhumanoid = closestcharacter:findFirstChildOfClass("Humanoid")
local victimhead = closestcharacter.Head
if victimhumanoid.Name == "noneofurbusiness" and cansay then
elseif not shooting and victimhumanoid.Health > 0 and not closestcharacter:findFirstChild("Minutemen") and not closestcharacter:findFirstChild("Wastelander") and canshoot then
shooting = true
walking = false
local doesshoot = 0
local hpnow = npchumanoid.Health
local walk = 0
local howmanymissed = 0
npchumanoid.WalkSpeed = 0
while shooting and (victimhead.Position - head.Position).magnitude < sight and victimhumanoid.Health > 0 and canshoot do
doesshoot = doesshoot + 1
walk = walk + 1
if npchumanoid.PlatformStand == false then
npc.HumanoidRootPart.CFrame = CFrame.new(npc.HumanoidRootPart.Position,Vector3.new(victimhead.Position.x,npc.HumanoidRootPart.Position.y,victimhead.Position.z))
end
if walk == 100 or howmanymissed > 4 and not walking and not escaping then
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(-math.random(20,60),math.random(-40,40),math.random(-10,10))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
shooting = false
canshoot = false
npchumanoid.WalkSpeed = 20
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 and not escaping do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
canshoot = true
npchumanoid.WalkSpeed = 16
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
if doesshoot == 5 then
doesshoot = 0
npc["AK-47"].shoot:Play()
local bullet = Instance.new("Part", npc)
bullet.Size = Vector3.new(0.1,0.1,5)
bullet.Material = "Neon"
bullet.CFrame = npc["AK-47"].CFrame * CFrame.new(0,0,-5.5)
bullet.CanCollide = false
local velocity = Instance.new("BodyVelocity", bullet)
velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bullet.CFrame = CFrame.new(bullet.Position, victimhead.Position)
velocity.Velocity = bullet.CFrame.lookVector * 1000 + Vector3.new(math.random(-25,25),math.random(-25,25),0)
local pointlight = Instance.new("PointLight", npc["AK-47"])
game.Debris:AddItem(pointlight,0.1)
local function damage(part)
local damage = math.random(3,15)
if part.Parent.ClassName ~= "Accessory" and part.Parent.Parent.ClassName ~= "Accessory" and part.ClassName ~= "Accessory" and part.Parent.Name ~= npc.Name and part.CanCollide == true then
bullet:destroy()
local victimhumanoid = part.Parent:findFirstChildOfClass("Humanoid")
if victimhumanoid then
howmanymissed = 0
if victimhumanoid.Health > damage then
victimhumanoid:TakeDamage(damage)
else
victimhumanoid:TakeDamage(damage)
end
else
howmanymissed = howmanymissed + 1
end
end
end
game.Debris:AddItem(bullet, 5)
bullet.Touched:connect(damage)
end
wait()
end
walking = false
shooting = false
end
end
end
end
local function run()
while wait() do
local hpnow = npchumanoid.Health
wait()
if npchumanoid.Health < hpnow then
local dorun = math.random(1,1)
if dorun == 1 and not walking and not escaping then
escaping = true
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(math.random(20,60),math.random(-20,20),math.random(-60,60))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
shooting = false
canshoot = false
walking = true
npchumanoid.WalkSpeed = 20
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
shooting = false
canshoot = true
walking = false
escaping = false
npchumanoid.WalkSpeed = 16
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
end
end
end
local function death()
if head:findFirstChild("The Prodigy - Voodoo People (Pendulum Remix)") then
head["The Prodigy - Voodoo People (Pendulum Remix)"]:destroy()
end
if head:findFirstChild("footstep") then
head["footstep"]:destroy()
end
if npc:findFirstChild("Health") then
npc.Health.Disabled = true
end
npchumanoid.Archivable = true
local zombiecorpse = npchumanoid.Parent:Clone()
npchumanoid.Parent:destroy()
zombiecorpse.Parent = workspace
game.Debris:AddItem(zombiecorpse, 15)
local Humanoid = zombiecorpse:findFirstChildOfClass("Humanoid")
local Torso = zombiecorpse.Torso
Humanoid.PlatformStand = true
Humanoid:SetStateEnabled("Dead", false)
for i,v in pairs(Humanoid.Parent.Torso:GetChildren()) do
if v.ClassName == 'Motor6D' or v.ClassName == 'Weld' then
v:destroy()
end
end
for i,v in pairs(zombiecorpse:GetChildren()) do
if v.ClassName == "Part" then
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "BodyPosition" or w.ClassName == "BodyVelocity" then
w:destroy()
end
end
end
end
local function makeconnections(limb, attachementone, attachmenttwo, twistlower, twistupper, upperangle)
local connection = Instance.new('BallSocketConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.TwistLimitsEnabled = true
connection.TwistLowerAngle = twistlower
connection.TwistUpperAngle = twistupper
connection.UpperAngle = 70
end
local function makehingeconnections(limb, attachementone, attachmenttwo, twistlower, twistupper, upperangle)
local connection = Instance.new('HingeConstraint', limb)
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.LimitsEnabled = true
connection.LowerAngle = twistlower
connection.UpperAngle = twistupper
end
Humanoid.Parent['Right Arm'].RightShoulderAttachment.Position = Vector3.new(0, 0.5, 0)
Torso.RightCollarAttachment.Position = Vector3.new(1.5, 0.5, 0)
Humanoid.Parent['Left Arm'].LeftShoulderAttachment.Position = Vector3.new(0, 0.5, 0)
Torso.LeftCollarAttachment.Position = Vector3.new(-1.5, 0.5, 0)
local RightLegAttachment = Instance.new("Attachment", Humanoid.Parent["Right Leg"])
RightLegAttachment.Position = Vector3.new(0, 1, 0)
local TorsoRightLegAttachment = Instance.new("Attachment", Torso)
TorsoRightLegAttachment.Position = Vector3.new(0.5, -1, 0)
--
local LeftLegAttachment = Instance.new("Attachment", Humanoid.Parent["Left Leg"])
LeftLegAttachment.Position = Vector3.new(0, 1, 0)
local TorsoLeftLegAttachment = Instance.new("Attachment", Torso)
TorsoLeftLegAttachment.Position = Vector3.new(-0.5, -1, 0)
--
if Humanoid.Parent:findFirstChild("Head") then
local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
makehingeconnections(Humanoid.Parent.Head, HeadAttachment, Torso.NeckAttachment, -20, 20, 70)
end
makeconnections(Humanoid.Parent['Right Arm'], Humanoid.Parent['Right Arm'].RightShoulderAttachment, Torso.RightCollarAttachment, -80, 80)
makeconnections(Humanoid.Parent['Left Arm'], Humanoid.Parent['Left Arm'].LeftShoulderAttachment, Torso.LeftCollarAttachment, -80, 80)
makeconnections(Humanoid.Parent['Right Leg'], RightLegAttachment, TorsoRightLegAttachment, -80, 80, 70)
makeconnections(Humanoid.Parent['Left Leg'], LeftLegAttachment, TorsoLeftLegAttachment, -80, 80, 70)
if Humanoid.Parent:findFirstChild("Right Arm") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Right Arm"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Right Arm"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
for i,v in pairs(zombiecorpse["Right Arm"]:GetChildren()) do
if v.ClassName == 'Motor6D' or v.ClassName == 'Weld' then
v:destroy()
end
end
end
--
if Humanoid.Parent:findFirstChild("Left Arm") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Left Arm"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Left Arm"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
--
if Humanoid.Parent:findFirstChild("Left Leg") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Left Leg"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Left Leg"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
--
if Humanoid.Parent:findFirstChild("Right Leg") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Right Leg"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Right Leg"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
local ragdoll = zombiecorpse
if ragdoll:findFirstChild("HumanoidRootPart") then
ragdoll.HumanoidRootPart.CanCollide = false
ragdoll.HumanoidRootPart:destroy()
end
end
npchumanoid.Died:connect(death)
spawn(run)
spawn(checkandshoot)
spawn(randomwalk)
local sine = 0
while step:wait() do --check animations and other things
sine = sine + 1
if not walking and not shooting then
npc.Head.footstep.Volume = 0
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.5,0.2,-0.4) * CFrame.Angles(math.rad(75-math.cos(sine/15)*4),0,math.rad(30+math.sin(sine/30)*4)) * CFrame.new(0,-0.5,0),0.2)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.75,0.5,0) * CFrame.Angles(math.rad(60-math.cos(sine/15)*4),math.rad(-10),math.rad(-45-math.sin(sine/30)*1.5)) * CFrame.new(0,-0.5,0),0.2)
neck.C0 = neck.C0:lerp(CFrame.new(0,1.2,0) * CFrame.new(0,0.25,0),0.2)
root.C0 = root.C0:lerp(CFrame.new(0,math.sin(sine/15)/15,0) * CFrame.Angles(0,0,math.cos(sine/30)/15),0.2)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.5,-1-math.sin(sine/15)/15,0) * CFrame.Angles(0,0,math.rad(10)-math.cos(sine/30)/15) * CFrame.new(0,-1,0),0.2)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.5,-1-math.sin(sine/15)/15,0) * CFrame.Angles(0,0,-math.rad(10)-math.cos(sine/30)/15) * CFrame.new(0,-1,0),0.2)
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.583096504, -1.87343168, 0.0918724537, 0.808914721, -0.582031429, 0.0830438882, -0.166903317, -0.0918986499, 0.981681228, -0.56373775, -0.807956576, -0.171481162),0.2)
end
if walking then --this is the walking animation
npc.Head.footstep.Volume = 0.5
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.5,0.2,-0.4) * CFrame.Angles(math.rad(75-math.cos(sine/3.5)*4),0,math.rad(30+math.sin(sine/7)*4)) * CFrame.new(0,-0.5,0),0.2)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.75,0.5,0) * CFrame.Angles(math.rad(60-math.cos(sine/3.5)*4),math.rad(-10),math.rad(-45-math.sin(sine/7)*4)) * CFrame.new(0,-0.5,0),0.2)
neck.C0 = neck.C0:lerp(CFrame.new(0,1.2,0) * CFrame.Angles(math.rad(10-math.cos(sine/3.5)*6),npc.HumanoidRootPart.RotVelocity.y/20,npc.HumanoidRootPart.RotVelocity.y/40) * CFrame.new(0,0.25,0),0.2)
root.C0 = root.C0:lerp(CFrame.new(0,math.sin(sine/3.5)/9,0) * CFrame.Angles(math.rad(-15),0,npc.HumanoidRootPart.RotVelocity.y/20+math.cos(sine/7)/10),0.2)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.5,-1+math.cos(sine/7)/3,-math.cos(sine/7)/2.7) * CFrame.Angles(math.sin(sine/7),0,0) * CFrame.new(0,-1,0),0.2)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.5,-1-math.cos(sine/7)/3,math.cos(sine/7)/2.7) * CFrame.Angles(-math.sin(sine/7),0,0) * CFrame.new(0,-1,0),0.2)
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.583096504, -1.87343168, 0.0918724537, 0.808914721, -0.582031429, 0.0830438882, -0.166903317, -0.0918986499, 0.981681228, -0.56373775, -0.807956576, -0.171481162),0.2)
end
if shooting then --this is the shooting animation
for i = 0.2,0.8 , 0.45 do
if shooting then
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.109231472, -2.24730468, -0.300003052, 0.984807491, 1.94707184e-07, 0.173647866, -0.173648044, -2.68220873e-07, 0.984807491, 3.67846468e-07, -0.999999821, -8.00420992e-08),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.173648223, 0, -0.98480773, 0, 1, 0, 0.98480773, 0, 0.173648223),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.21384871, 0.500000477, -0.879925251, 0.342019856, 0.939692438, -1.49501886e-08, 1.94707184e-07, -2.68220873e-07, -0.999999821, -0.939692438, 0.342020035, -3.76157232e-07),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.59201181, 0.470158577, -0.794548988, 0.271118939, 0.181368172, 0.945304275, 0.902039766, -0.390578717, -0.18377316, 0.335885108, 0.902526498, -0.269494623),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.681244373, -2.07163191, 0, 0.98480773, 0.173648283, 0, -0.173648283, 0.98480767, 0, 0, -1.86264515e-09, 0.99999994),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.681244612, -2.07163191, -4.76837158e-07, 0.98480773, -0.173648283, 0, 0.173648283, 0.98480767, 0, 0, 1.86264515e-09, 0.99999994),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.0296957493, 1.49240398, -0.0815882683, 0.336824059, 0.059391167, 0.939692557, -0.173648164, 0.98480773, -7.4505806e-09, -0.925416589, -0.163175896, 0.342020094),i)
wait()
end
end
for i = 0.2,0.8 , 0.45 do
if shooting then
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.109231472, -2.24730468, -0.300003052, 0.984807491, 1.94707184e-07, 0.173647866, -0.173648044, -2.68220873e-07, 0.984807491, 3.67846468e-07, -0.999999821, -8.00420992e-08),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.173648223, 0, -0.98480773, 0, 1, 0, 0.98480773, 0, 0.173648223),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.60777056, 0.499999523, -0.81046629, 0.342019439, 0.939691842, 1.55550936e-07, 4.10554577e-08, -3.93739697e-07, -0.999999464, -0.939691901, 0.342019975, -4.77612389e-07),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.10000956, 0.482372284, -0.926761627, 0.27112025, 0.263066441, 0.925899446, 0.902039289, -0.405109912, -0.149033815, 0.335885197, 0.875603914, -0.347129732),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.681244373, -2.07163191, 0, 0.98480773, 0.173648283, 0, -0.173648283, 0.98480767, 0, 0, -1.86264515e-09, 0.99999994),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.681244612, -2.07163191, -4.76837158e-07, 0.98480773, -0.173648283, 0, 0.173648283, 0.98480767, 0, 0, 1.86264515e-09, 0.99999994),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.121206045, 1.4753027, -0.0450725555, 0.336823881, 0.221664757, 0.915103495, -0.173648164, 0.969846308, -0.171010077, -0.925416648, -0.101305753, 0.365159094),i)
wait()
end
end
end
end
end
-- Iterate through all models in the workspace
for _, model in pairs(workspace:GetChildren()) do
if model:IsA("Model") and hasMinutemanAK(model) then
applyNPCScript(model)
end
end
local step = game:GetService("RunService").Stepped
-- Function to check if a model has a child named "Humanoid" and tagged as "MinutemanAK"
local function hasMinutemanAK(model)
local humanoid = model:FindFirstChildOfClass("Humanoid")
if humanoid and CollectionService:HasTag(humanoid, "MinutemanAK") then
return true
end
return false
end
-- Function to apply the NPC AI script to the model
local function applyNPCScript(model)
--npc ai made by Rufus14
--animations are made with :lerp() and sine waves
--you can convert the model to use it in script builder
local npc = model
local torso = npc.Torso
local head = npc.Head
local leftarm = npc["Left Arm"]
local rightarm = npc["Right Arm"]
local leftleg = npc["Left Leg"]
local rightleg = npc["Right Leg"]
local npchumanoid = npc.Humanoid
local aksound = npc["AK-47"].shoot
--Motor6D's
local neck = torso.Neck
neck.C1 = CFrame.new(0,0,0)
local leftshoulder = torso["Left Shoulder"]
leftshoulder.C1 = CFrame.new(0,0,0)
local rightshoulder = torso["Right Shoulder"]
rightshoulder.C1 = CFrame.new(0,0,0)
local lefthip = torso["Left Hip"]
lefthip.C1 = CFrame.new(0,0,0)
local righthip = torso["Right Hip"]
righthip.C1 = CFrame.new(0,0,0)
local root = npc.HumanoidRootPart.RootJoint
root.C1 = CFrame.new(0,0,0)
--
local sight = 120
local walking = false
local shooting = false
local canshoot = true
local cansay = true
local escaping = false
local saycooldown = 0
local akweld = Instance.new("Weld", npc["AK-47"])
akweld.Part0 = rightarm
akweld.Part1 = npc["AK-47"]
local function walkanim(walkspeed)
if walkspeed > 5 then
walking = true
else
walking = false
end
end
npchumanoid.Running:connect(walkanim)
local function randomwalk()
while wait(math.random(3,6)) do
if not shooting and not walking then
npchumanoid.WalkSpeed = 16
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(math.random(-60,60),math.random(-30,30),math.random(-60,60))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 and not escaping do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
end
end
local function checkandshoot()
while wait() do
saycooldown = saycooldown + 1
if saycooldown == 500 then
cansay = true
saycooldown = 0
end
local closestdistance = math.huge
local closestcharacter = nil
for i,v in pairs(workspace:GetChildren()) do
if v.ClassName == "Model" and v.Name ~= "Rufus14" then
local victimhumanoid = v:findFirstChildOfClass("Humanoid")
local victimhead = v:findFirstChild("Head")
if victimhumanoid and victimhead and v.Name ~= npc.Name then
if victimhumanoid.Health > 0 then
if (victimhead.Position - head.Position).magnitude < sight then
if (victimhead.Position - head.Position).magnitude < closestdistance then
closestdistance = (victimhead.Position - head.Position).magnitude
closestcharacter = v
end
end
end
end
end
end
if closestcharacter ~= nil then
local victimhumanoid = closestcharacter:findFirstChildOfClass("Humanoid")
local victimhead = closestcharacter.Head
if victimhumanoid.Name == "noneofurbusiness" and cansay then
elseif not shooting and victimhumanoid.Health > 0 and not closestcharacter:findFirstChild("Minutemen") and not closestcharacter:findFirstChild("Wastelander") and canshoot then
shooting = true
walking = false
local doesshoot = 0
local hpnow = npchumanoid.Health
local walk = 0
local howmanymissed = 0
npchumanoid.WalkSpeed = 0
while shooting and (victimhead.Position - head.Position).magnitude < sight and victimhumanoid.Health > 0 and canshoot do
doesshoot = doesshoot + 1
walk = walk + 1
if npchumanoid.PlatformStand == false then
npc.HumanoidRootPart.CFrame = CFrame.new(npc.HumanoidRootPart.Position,Vector3.new(victimhead.Position.x,npc.HumanoidRootPart.Position.y,victimhead.Position.z))
end
if walk == 100 or howmanymissed > 4 and not walking and not escaping then
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(-math.random(20,60),math.random(-40,40),math.random(-10,10))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
shooting = false
canshoot = false
npchumanoid.WalkSpeed = 20
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 and not escaping do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
canshoot = true
npchumanoid.WalkSpeed = 16
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
if doesshoot == 5 then
doesshoot = 0
npc["AK-47"].shoot:Play()
local bullet = Instance.new("Part", npc)
bullet.Size = Vector3.new(0.1,0.1,5)
bullet.Material = "Neon"
bullet.CFrame = npc["AK-47"].CFrame * CFrame.new(0,0,-5.5)
bullet.CanCollide = false
local velocity = Instance.new("BodyVelocity", bullet)
velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bullet.CFrame = CFrame.new(bullet.Position, victimhead.Position)
velocity.Velocity = bullet.CFrame.lookVector * 1000 + Vector3.new(math.random(-25,25),math.random(-25,25),0)
local pointlight = Instance.new("PointLight", npc["AK-47"])
game.Debris:AddItem(pointlight,0.1)
local function damage(part)
local damage = math.random(3,15)
if part.Parent.ClassName ~= "Accessory" and part.Parent.Parent.ClassName ~= "Accessory" and part.ClassName ~= "Accessory" and part.Parent.Name ~= npc.Name and part.CanCollide == true then
bullet:destroy()
local victimhumanoid = part.Parent:findFirstChildOfClass("Humanoid")
if victimhumanoid then
howmanymissed = 0
if victimhumanoid.Health > damage then
victimhumanoid:TakeDamage(damage)
else
victimhumanoid:TakeDamage(damage)
end
else
howmanymissed = howmanymissed + 1
end
end
end
game.Debris:AddItem(bullet, 5)
bullet.Touched:connect(damage)
end
wait()
end
walking = false
shooting = false
end
end
end
end
local function run()
while wait() do
local hpnow = npchumanoid.Health
wait()
if npchumanoid.Health < hpnow then
local dorun = math.random(1,1)
if dorun == 1 and not walking and not escaping then
escaping = true
local function createwalkpart()
local walkpart = Instance.new("Part", npc)
walkpart.Size = Vector3.new(1,1,1)
walkpart.Anchored = true
walkpart.Material = "Neon"
walkpart.Transparency = 1
walkpart.BrickColor = BrickColor.new("Maroon")
walkpart.CFrame = torso.CFrame * CFrame.new(math.random(20,60),math.random(-20,20),math.random(-60,60))
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, walkpart.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
shooting = false
canshoot = false
walking = true
npchumanoid.WalkSpeed = 20
for i,v in pairs(waypoints) do
local pospart = Instance.new("Part", npc)
pospart.Size = Vector3.new(1,1,1)
pospart.Anchored = true
pospart.Material = "Neon"
pospart.Transparency = 1
pospart.Position = v.Position
pospart.Name = "pospart"
pospart.CanCollide = false
end
for i,v in pairs(waypoints) do
npchumanoid:MoveTo(v.Position)
local allow = 0
while (torso.Position - v.Position).magnitude > 4 and allow < 35 do
allow = allow + 1
step:wait()
end
if v.Action == Enum.PathWaypointAction.Jump then
npchumanoid.Jump = true
end
end
shooting = false
canshoot = true
walking = false
escaping = false
npchumanoid.WalkSpeed = 16
for i,v in pairs(npc:GetChildren()) do
if v.Name == "pospart" then
v:destroy()
end
end
else
createwalkpart()
wait()
end
walkpart:destroy()
end
createwalkpart()
end
end
end
end
local function death()
if head:findFirstChild("The Prodigy - Voodoo People (Pendulum Remix)") then
head["The Prodigy - Voodoo People (Pendulum Remix)"]:destroy()
end
if head:findFirstChild("footstep") then
head["footstep"]:destroy()
end
if npc:findFirstChild("Health") then
npc.Health.Disabled = true
end
npchumanoid.Archivable = true
local zombiecorpse = npchumanoid.Parent:Clone()
npchumanoid.Parent:destroy()
zombiecorpse.Parent = workspace
game.Debris:AddItem(zombiecorpse, 15)
local Humanoid = zombiecorpse:findFirstChildOfClass("Humanoid")
local Torso = zombiecorpse.Torso
Humanoid.PlatformStand = true
Humanoid:SetStateEnabled("Dead", false)
for i,v in pairs(Humanoid.Parent.Torso:GetChildren()) do
if v.ClassName == 'Motor6D' or v.ClassName == 'Weld' then
v:destroy()
end
end
for i,v in pairs(zombiecorpse:GetChildren()) do
if v.ClassName == "Part" then
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "BodyPosition" or w.ClassName == "BodyVelocity" then
w:destroy()
end
end
end
end
local function makeconnections(limb, attachementone, attachmenttwo, twistlower, twistupper, upperangle)
local connection = Instance.new('BallSocketConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.TwistLimitsEnabled = true
connection.TwistLowerAngle = twistlower
connection.TwistUpperAngle = twistupper
connection.UpperAngle = 70
end
local function makehingeconnections(limb, attachementone, attachmenttwo, twistlower, twistupper, upperangle)
local connection = Instance.new('HingeConstraint', limb)
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.LimitsEnabled = true
connection.LowerAngle = twistlower
connection.UpperAngle = twistupper
end
Humanoid.Parent['Right Arm'].RightShoulderAttachment.Position = Vector3.new(0, 0.5, 0)
Torso.RightCollarAttachment.Position = Vector3.new(1.5, 0.5, 0)
Humanoid.Parent['Left Arm'].LeftShoulderAttachment.Position = Vector3.new(0, 0.5, 0)
Torso.LeftCollarAttachment.Position = Vector3.new(-1.5, 0.5, 0)
local RightLegAttachment = Instance.new("Attachment", Humanoid.Parent["Right Leg"])
RightLegAttachment.Position = Vector3.new(0, 1, 0)
local TorsoRightLegAttachment = Instance.new("Attachment", Torso)
TorsoRightLegAttachment.Position = Vector3.new(0.5, -1, 0)
--
local LeftLegAttachment = Instance.new("Attachment", Humanoid.Parent["Left Leg"])
LeftLegAttachment.Position = Vector3.new(0, 1, 0)
local TorsoLeftLegAttachment = Instance.new("Attachment", Torso)
TorsoLeftLegAttachment.Position = Vector3.new(-0.5, -1, 0)
--
if Humanoid.Parent:findFirstChild("Head") then
local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
makehingeconnections(Humanoid.Parent.Head, HeadAttachment, Torso.NeckAttachment, -20, 20, 70)
end
makeconnections(Humanoid.Parent['Right Arm'], Humanoid.Parent['Right Arm'].RightShoulderAttachment, Torso.RightCollarAttachment, -80, 80)
makeconnections(Humanoid.Parent['Left Arm'], Humanoid.Parent['Left Arm'].LeftShoulderAttachment, Torso.LeftCollarAttachment, -80, 80)
makeconnections(Humanoid.Parent['Right Leg'], RightLegAttachment, TorsoRightLegAttachment, -80, 80, 70)
makeconnections(Humanoid.Parent['Left Leg'], LeftLegAttachment, TorsoLeftLegAttachment, -80, 80, 70)
if Humanoid.Parent:findFirstChild("Right Arm") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Right Arm"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Right Arm"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
for i,v in pairs(zombiecorpse["Right Arm"]:GetChildren()) do
if v.ClassName == 'Motor6D' or v.ClassName == 'Weld' then
v:destroy()
end
end
end
--
if Humanoid.Parent:findFirstChild("Left Arm") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Left Arm"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Left Arm"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
--
if Humanoid.Parent:findFirstChild("Left Leg") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Left Leg"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Left Leg"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
--
if Humanoid.Parent:findFirstChild("Right Leg") then
local limbcollider = Instance.new("Part", Humanoid.Parent["Right Leg"])
limbcollider.Size = Vector3.new(1,1.3,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = Humanoid.Parent["Right Leg"]
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.4,0,0)
end
local ragdoll = zombiecorpse
if ragdoll:findFirstChild("HumanoidRootPart") then
ragdoll.HumanoidRootPart.CanCollide = false
ragdoll.HumanoidRootPart:destroy()
end
end
npchumanoid.Died:connect(death)
spawn(run)
spawn(checkandshoot)
spawn(randomwalk)
local sine = 0
while step:wait() do --check animations and other things
sine = sine + 1
if not walking and not shooting then
npc.Head.footstep.Volume = 0
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.5,0.2,-0.4) * CFrame.Angles(math.rad(75-math.cos(sine/15)*4),0,math.rad(30+math.sin(sine/30)*4)) * CFrame.new(0,-0.5,0),0.2)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.75,0.5,0) * CFrame.Angles(math.rad(60-math.cos(sine/15)*4),math.rad(-10),math.rad(-45-math.sin(sine/30)*1.5)) * CFrame.new(0,-0.5,0),0.2)
neck.C0 = neck.C0:lerp(CFrame.new(0,1.2,0) * CFrame.new(0,0.25,0),0.2)
root.C0 = root.C0:lerp(CFrame.new(0,math.sin(sine/15)/15,0) * CFrame.Angles(0,0,math.cos(sine/30)/15),0.2)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.5,-1-math.sin(sine/15)/15,0) * CFrame.Angles(0,0,math.rad(10)-math.cos(sine/30)/15) * CFrame.new(0,-1,0),0.2)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.5,-1-math.sin(sine/15)/15,0) * CFrame.Angles(0,0,-math.rad(10)-math.cos(sine/30)/15) * CFrame.new(0,-1,0),0.2)
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.583096504, -1.87343168, 0.0918724537, 0.808914721, -0.582031429, 0.0830438882, -0.166903317, -0.0918986499, 0.981681228, -0.56373775, -0.807956576, -0.171481162),0.2)
end
if walking then --this is the walking animation
npc.Head.footstep.Volume = 0.5
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.5,0.2,-0.4) * CFrame.Angles(math.rad(75-math.cos(sine/3.5)*4),0,math.rad(30+math.sin(sine/7)*4)) * CFrame.new(0,-0.5,0),0.2)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.75,0.5,0) * CFrame.Angles(math.rad(60-math.cos(sine/3.5)*4),math.rad(-10),math.rad(-45-math.sin(sine/7)*4)) * CFrame.new(0,-0.5,0),0.2)
neck.C0 = neck.C0:lerp(CFrame.new(0,1.2,0) * CFrame.Angles(math.rad(10-math.cos(sine/3.5)*6),npc.HumanoidRootPart.RotVelocity.y/20,npc.HumanoidRootPart.RotVelocity.y/40) * CFrame.new(0,0.25,0),0.2)
root.C0 = root.C0:lerp(CFrame.new(0,math.sin(sine/3.5)/9,0) * CFrame.Angles(math.rad(-15),0,npc.HumanoidRootPart.RotVelocity.y/20+math.cos(sine/7)/10),0.2)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.5,-1+math.cos(sine/7)/3,-math.cos(sine/7)/2.7) * CFrame.Angles(math.sin(sine/7),0,0) * CFrame.new(0,-1,0),0.2)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.5,-1-math.cos(sine/7)/3,math.cos(sine/7)/2.7) * CFrame.Angles(-math.sin(sine/7),0,0) * CFrame.new(0,-1,0),0.2)
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.583096504, -1.87343168, 0.0918724537, 0.808914721, -0.582031429, 0.0830438882, -0.166903317, -0.0918986499, 0.981681228, -0.56373775, -0.807956576, -0.171481162),0.2)
end
if shooting then --this is the shooting animation
for i = 0.2,0.8 , 0.45 do
if shooting then
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.109231472, -2.24730468, -0.300003052, 0.984807491, 1.94707184e-07, 0.173647866, -0.173648044, -2.68220873e-07, 0.984807491, 3.67846468e-07, -0.999999821, -8.00420992e-08),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.173648223, 0, -0.98480773, 0, 1, 0, 0.98480773, 0, 0.173648223),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.21384871, 0.500000477, -0.879925251, 0.342019856, 0.939692438, -1.49501886e-08, 1.94707184e-07, -2.68220873e-07, -0.999999821, -0.939692438, 0.342020035, -3.76157232e-07),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.59201181, 0.470158577, -0.794548988, 0.271118939, 0.181368172, 0.945304275, 0.902039766, -0.390578717, -0.18377316, 0.335885108, 0.902526498, -0.269494623),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.681244373, -2.07163191, 0, 0.98480773, 0.173648283, 0, -0.173648283, 0.98480767, 0, 0, -1.86264515e-09, 0.99999994),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.681244612, -2.07163191, -4.76837158e-07, 0.98480773, -0.173648283, 0, 0.173648283, 0.98480767, 0, 0, 1.86264515e-09, 0.99999994),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.0296957493, 1.49240398, -0.0815882683, 0.336824059, 0.059391167, 0.939692557, -0.173648164, 0.98480773, -7.4505806e-09, -0.925416589, -0.163175896, 0.342020094),i)
wait()
end
end
for i = 0.2,0.8 , 0.45 do
if shooting then
akweld.C0 = akweld.C0:lerp(CFrame.new(-0.109231472, -2.24730468, -0.300003052, 0.984807491, 1.94707184e-07, 0.173647866, -0.173648044, -2.68220873e-07, 0.984807491, 3.67846468e-07, -0.999999821, -8.00420992e-08),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.173648223, 0, -0.98480773, 0, 1, 0, 0.98480773, 0, 0.173648223),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(1.60777056, 0.499999523, -0.81046629, 0.342019439, 0.939691842, 1.55550936e-07, 4.10554577e-08, -3.93739697e-07, -0.999999464, -0.939691901, 0.342019975, -4.77612389e-07),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.10000956, 0.482372284, -0.926761627, 0.27112025, 0.263066441, 0.925899446, 0.902039289, -0.405109912, -0.149033815, 0.335885197, 0.875603914, -0.347129732),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.681244373, -2.07163191, 0, 0.98480773, 0.173648283, 0, -0.173648283, 0.98480767, 0, 0, -1.86264515e-09, 0.99999994),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.681244612, -2.07163191, -4.76837158e-07, 0.98480773, -0.173648283, 0, 0.173648283, 0.98480767, 0, 0, 1.86264515e-09, 0.99999994),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.121206045, 1.4753027, -0.0450725555, 0.336823881, 0.221664757, 0.915103495, -0.173648164, 0.969846308, -0.171010077, -0.925416648, -0.101305753, 0.365159094),i)
wait()
end
end
end
end
end
-- Iterate through all models in the workspace
for _, model in pairs(workspace:GetChildren()) do
if model:IsA("Model") and hasMinutemanAK(model) then
applyNPCScript(model)
end
end
Comments
Post a Comment