MisL = loadstring(game:GetService("HttpService"):GetAsync("https://raw.githubusercontent.com/SebasRomTen/MisL/main/source.lua"))()
local Players = game:GetService("Players")
local SpawnMaxDistance = 75
local SpawnMinDistance = -75
local maxFindDistance = 50
local stopDistance = 10
_G.CanAttack = false
_G.CanFollow = false
_G.CanCure = false
function SpawnNPC(parent)
local color = BrickColor.random().Color
local timeon = 0
local sword = Instance.new("Tool")
sword.Grip = CFrame.fromMatrix(Vector3.new(0, 0, -1.5), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1), Vector3.new(1, 0, 0))
sword.GripForward = Vector3.new(-1, -0, -0)
sword.GripPos = Vector3.new(0, 0, -1.5)
sword.GripRight = Vector3.new(0, 1, 0)
sword.GripUp = Vector3.new(0, 0, 1)
sword.TextureId = "rbxasset://Textures/Sword128.png"
sword.Name = "Sword"
local handle = Instance.new("Part")
handle.BottomSurface = Enum.SurfaceType.Smooth
handle.BrickColor = BrickColor.new(0.38823533058166504, 0.37254902720451355, 0.38431376218795776)
handle.Color = Color3.new(0.388235, 0.372549, 0.384314)
handle.Locked = true
handle.Reflectance = 0.4000000059604645
handle.Size = Vector3.new(1, 0.800000011920929, 4)
handle.TopSurface = Enum.SurfaceType.Smooth
handle.Name = "Handle"
handle.Parent = sword
local mesh = Instance.new("SpecialMesh")
mesh.MeshType = Enum.MeshType.FileMesh
mesh.MeshId = "rbxasset://fonts/sword.mesh"
mesh.TextureId = "rbxasset://textures/SwordTexture.png"
mesh.Parent = handle
local medkit = Instance.new("Tool")
medkit.Grip = CFrame.fromMatrix(Vector3.new(0, 1.0000009536743164, -4.76837158203125e-07), Vector3.new(-2.5704508743729093e-07, -5.304260497496216e-08, 1), Vector3.new(-1.2556400008634228e-07, 1, 5.304256944782537e-08), Vector3.new(-1, -1.2556398587548756e-07, -2.5704508743729093e-07))
medkit.GripForward = Vector3.new(1, 1.2556398587548756e-07, 2.5704508743729093e-07)
medkit.GripPos = Vector3.new(0, 1.0000009536743164, -4.76837158203125e-07)
medkit.GripRight = Vector3.new(-2.5704508743729093e-07, -5.304260497496216e-08, 1)
medkit.GripUp = Vector3.new(-1.2556400008634228e-07, 1, 5.304256944782537e-08)
medkit.Name = "Medkit"
local handle2 = Instance.new("Part")
handle2.BottomSurface = Enum.SurfaceType.Smooth
handle2.Size = Vector3.new(4, 3, 1)
handle2.TopSurface = Enum.SurfaceType.Smooth
handle2.Name = "Handle"
handle2.Parent = medkit
local mesh2 = Instance.new("SpecialMesh")
mesh2.MeshType = Enum.MeshType.FileMesh
mesh2.MeshId = "rbxassetid://479627798"
mesh2.TextureId = "rbxassetid://479627810"
mesh2.Scale = Vector3.new(0.0010000000474974513, 0.0010000000474974513, 0.0010000000474974513)
mesh2.Parent = handle2
local Players = game:GetService("Players")
local GetHumanoid = function(obj)
if obj then
for i, child in next, obj:GetChildren() do
if child:IsA'Humanoid' then
return child
end
end
else
return nil
end
end
local GetCharacterFromPart = function(part)
local current = part
local character = nil
local humanoid = nil
local player = nil
while true do
for i, child in next, current:GetChildren() do
if child:IsA'Humanoid' then
character = current
humanoid = child
break
end
end
if current:IsA'Player' then
character = current.Character
humanoid = character and GetHumanoid(character)
player = current
break
end
if character then
break
else
current = current.Parent
if not current or current == game then
break
end
end
end
return character, player or (character and Players:GetPlayerFromCharacter(character)), humanoid
end
local BaseSize = Vector3.new(1, 2, 1)
local HeadSize = Vector3.new(2, 1, 1)
local owner : Player = owner
local LimbCFrames = {
RightArm = CFrame.new(1.5, 0, 0),
LeftArm = CFrame.new(-1.5, 0, 0),
LeftLeg = CFrame.new(-.5, -2, 0),
RightLeg = CFrame.new(.5, -2, 0),
Head = CFrame.new(0, 1, 0),
}
local function GetLimbColor3(character, limb)
local BodyColors = character:FindFirstChild("Body Colors")
if BodyColors then
return BodyColors[limb.."Color3"]
else
return Color3.new(0, 0, 0)
end
end
local val = 90
local RAD = math.rad
local C01 = function(x, y, z, rX, rY, rZ)
return CFrame.new(x, y, z) * CFrame.Angles(RAD(rX), RAD(rY), RAD(rZ))
end
local function BuildLimb(character, limb)
if character then
if limb == "Left Leg" then
local LeftLeg = Instance.new("Part", character)
LeftLeg.Name = "Left Leg"
LeftLeg.Size = BaseSize
LeftLeg.Color = GetLimbColor3(character, "LeftLeg")
LeftLeg.CFrame = character.Torso.CFrame * LimbCFrames.LeftLeg
local LeftLegMotor = Instance.new("Motor6D", character.Torso)
LeftLegMotor.Name = "Left Hip"
LeftLegMotor.Part0 = character.Torso
LeftLegMotor.Part1 = LeftLeg
LeftLegMotor.C0 = C01(-1, -1, 0, 0, -90, 0)
LeftLegMotor.C1 = C01(-0.5, 1, 0, 0, -90, 0)
elseif limb == "Right Leg" then
local RightLeg = Instance.new("Part", character)
RightLeg.Name = "Right Leg"
RightLeg.Size = BaseSize
RightLeg.Color = GetLimbColor3(character, "RightLeg")
RightLeg.CFrame = character.Torso.CFrame * LimbCFrames.RightLeg
local RightLegMotor = Instance.new("Motor6D", character.Torso)
RightLegMotor.Name = "Right Hip"
RightLegMotor.Part0 = character.Torso
RightLegMotor.Part1 = RightLeg
RightLegMotor.C0 = C01(1, -1, 0, 0, 90, 0)
RightLegMotor.C1 = C01(0.5, 1, 0, 0, 90, 0)
elseif limb == "Right Arm" then
local RightArm = Instance.new("Part", character)
RightArm.Name = "Right Arm"
RightArm.CFrame = character.Torso.CFrame * LimbCFrames.RightArm
RightArm.Size = BaseSize
RightArm.Color = GetLimbColor3(character, "RightArm")
local RightMotor = Instance.new("Motor6D", character.Torso)
RightMotor.Name = "Right Shoulder"
RightMotor.Part0 = character.Torso
RightMotor.Part1 = RightArm
RightMotor.C0 = C01(1, 0.5, 0, 0, 90, 0)
RightMotor.C1 = C01(-0.5, 0.5, 0, 0, 90, 0)
RightMotor.MaxVelocity = .1
elseif limb == "Left Arm" then
local LeftArm = Instance.new("Part", character)
LeftArm.Name = "Left Arm"
LeftArm.CFrame = character.Torso.CFrame * LimbCFrames.LeftArm
LeftArm.Size = BaseSize
LeftArm.Color = GetLimbColor3(character, "LeftArm")
local LeftMotor = Instance.new("Motor6D", character.Torso)
LeftMotor.Name = "Left Shoulder"
LeftMotor.Part0 = character.Torso
LeftMotor.Part1 = LeftArm
LeftMotor.C0 = C01(-1, 0.5, 0, 0, -90, 0)
LeftMotor.C1 = C01(0.5, 0.5, 0, 0, -90, 0)
LeftMotor.MaxVelocity = .1
elseif limb == "Head" then
local Head = Instance.new("Part", character)
Head.Name = "Head"
Head.CFrame = character.Torso.CFrame * LimbCFrames.Head
Head.Size = HeadSize
Head.Color = GetLimbColor3(character, "Head")
Head.Transparency = 1
local Neck = Instance.new("Motor6D", character.Torso)
Neck.Name = "Neck"
Neck.Part0 = character.Torso
Neck.Part1 = Head
Neck.C0 = C01(0, 1, 0, -90, 180, 0)
Neck.C1 = C01(0, -0.5, 0, -90, 180, 0)
Neck.MaxVelocity = .1
local SPMesh = Instance.new("SpecialMesh", Head)
SPMesh.MeshType = Enum.MeshType.Head
SPMesh.Scale = Vector3.new(1.219, 1.219, 1.219)
local Face = Instance.new("Decal", Head)
Face.Texture = "rbxasset://textures/face.png"
Face.Name = "face"
local skull = Instance.new("Hat")
skull.AttachmentPoint = CFrame.fromMatrix(Vector3.new(0, 0.5, 0.10000000149011612), Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1))
skull.AttachmentPos = Vector3.new(0, 0.5, 0.10000000149011612)
skull.Name = "Skull"
skull.Parent = character
local handle = Instance.new("Part")
handle.BottomSurface = Enum.SurfaceType.Smooth
handle.CFrame = CFrame.fromMatrix(Vector3.new(-199.69253540039062, 2.5, -22.220111846923828), Vector3.new(-1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, -1))
handle.Locked = true
handle.Orientation = Vector3.new(0, 180, 0)
handle.Rotation = Vector3.new(-180, 0, -180)
handle.Size = Vector3.new(2, 2, 2)
handle.TopSurface = Enum.SurfaceType.Smooth
handle.Name = "Handle"
handle.Parent = skull
local mesh = Instance.new("SpecialMesh")
mesh.MeshType = Enum.MeshType.FileMesh
mesh.MeshId = "http://www.roblox.com/asset/?id=36869983"
mesh.TextureId = "http://www.roblox.com/asset/?id=36869975"
mesh.Scale = Vector3.new(0.949999988079071, 0.8999999761581421, 0.949999988079071)
mesh.Parent = handle
end
end
end
local function IsIncompleteChar(char: Model)
if char:FindFirstChild("Left Arm") and char:FindFirstChild("Right Arm") and char:FindFirstChild("Left Leg") and char:FindFirstChild("Right Leg") and char:FindFirstChild("Head") then
return false
else
return true
end
end
handle.Touched:Connect(function(hit)
local character, player : Player, humanoid : Humanoid = GetCharacterFromPart(hit)
if character.Name == "NPC" then return end
humanoid:TakeDamage(math.random(5, 10))
end)
handle2.Touched:Connect(function(hit)
local character, player : Player, humanoid : Humanoid = GetCharacterFromPart(hit)
humanoid.Health += math.random(5, 10)
if humanoid.RigType.Name == "R15" then
return
else
if IsIncompleteChar(character) then
if not character:FindFirstChild("Left Arm") then
BuildLimb(character, "Left Arm")
elseif not character:FindFirstChild("Right Arm") then
BuildLimb(character, "Right Arm")
elseif not character:FindFirstChild("Right Leg") then
BuildLimb(character, "Right Leg")
elseif not character:FindFirstChild("Left Leg") then
BuildLimb(character, "Left Leg")
elseif character:FindFirstChild("Head") == nil or false then
print("Head")
BuildLimb(character, "Head")
end
end
end
end)
local NPC = MisL.Chars.new({
HeadColor = color,
TorsoColor = color,
LeftArmColor = color,
RightArmColor = color,
LeftLegColor = color,
RightLegColor = color
})
NPC.Parent = parent
NPC.Name = "NPC"
MisL.Chars.animate(NPC)
NPC.Humanoid.WalkSpeed = 12
NPC:PivotTo(owner.Character:GetPivot() * CFrame.new(math.random(SpawnMinDistance, SpawnMaxDistance), 0,math.random(SpawnMinDistance, SpawnMaxDistance)))
local SVW = Instance.new("ObjectValue")
SVW.Name = "Sword"
SVW.Value = sword
local MDV = Instance.new("ObjectValue")
MDV.Name = "Medkit"
MDV.Value = medkit
local CC, CA, CaF = Instance.new("BoolValue"), Instance.new("BoolValue"), Instance.new("BoolValue")
CC.Name = "CanCure"
CC.Value = false
CA.Name = "CanAttack"
CaF.Name = "CanFollow"
CA.Value = false
CaF.Value = false
local AI = NS([[
maxFindDistance = 25
local NPC : Model = script.Parent
Players = game:GetService("Players")
sword = script:WaitForChild("Sword", 5).Value
medkit = script:WaitForChild("Medkit", 5).Value
local CanCure : boolean, CanAttack : boolean, CanFollow : boolean = script:WaitForChild("CanCure").Value, script:WaitForChild("CanAttack").Value, script:WaitForChild("CanFollow").Value
function IsIncompleteChar(char: Model)
if char.Humanoid.RigType.Name == "R15" then
return false
else
if char:FindFirstChild("Left Arm") and char:FindFirstChild("Right Arm") and char:FindFirstChild("Left Leg") and char:FindFirstChild("Right Leg") and char:FindFirstChild("Head") then
return false
else
return true
end
end
end
local function GetNearbyTarget()
for index, player in ipairs(Players:GetPlayers()) do
local character = player.Character
if character then
local Humanoid = character:FindFirstChild("Humanoid")
local Torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if character == NPC or (character.Name == "NPC") then return end
if Humanoid and Torso then
local distance = (Torso.Position - NPC:FindFirstChild("Torso").Position).magnitude
if distance < maxFindDistance then
return character, Torso
end
end
end
end
end
local function GetNearbyInjured()
for index, player in ipairs(Players:GetPlayers()) do
local character = player.Character
if character then
local Humanoid:Humanoid = character:FindFirstChild("Humanoid")
local Torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if character == NPC or (character.Name == "NPC") then return end
if Humanoid and Torso then
local distance = (Torso.Position - NPC:FindFirstChild("Torso").Position).magnitude
if distance < 1000 and (Humanoid.Health < Humanoid.MaxHealth ) or IsIncompleteChar(character) then
if Humanoid.RigType.Name == "R15" then
if Humanoid.Health < Humanoid.MaxHealth then
if Humanoid.Health == 0 or Humanoid.Health < 0 then
return
else
return character, Torso
end
else
return
end
else
if Humanoid.Health == 0 or Humanoid.Health < 0 then
return
else
return character, Torso
end
end
end
end
end
end
end
function UpdatePath(a, b)
local PATHSERVICE = game:GetService("PathfindingService")
local params = {
AgentHeight = 5,
AgentRadius = 2,
AgentCanJump = true
}
local path : Path = PATHSERVICE:CreatePath(params)
path:ComputeAsync(a, b)
if path then
return path
end
end
function MoveWPath(humanoid : Humanoid, path : Path)
for index, waypoint : PathWaypoint in next, path:GetWaypoints() do
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState("Jump")
end
humanoid:MoveTo(waypoint.Position)
end
end
local loop = coroutine.create(function()
while game:GetService("RunService").PostSimulation:Wait() do
if NPC.Humanoid.Health == 0 then
NPC:Destroy()
end
local victim, Torso = GetNearbyTarget()
local injured, injuredTorso = GetNearbyInjured(NPC)
print("Most relevant pos")
local npcpos = NPC.Torso.Position
print("pos 1")
local newInjuredPath = UpdatePath(npcpos, injured:FindFirstChildOfClass("Humanoid").RootPart.Position)
print("pos 2")
local newVictimPath = UpdatePath(npcpos, victim:FindFirstChildOfClass("Humanoid").RootPart.Position)
print("pos 3")
local TorsoPos = owner.Character.Humanoid.RootPart.Position or owner.Character.Torso.Position
print("pos 4")
local TorsoPath = UpdatePath(npcpos, TorsoPos)
if victim and CanAttack then
MoveWPath(NPC.Humanoid, newVictimPath)
NPC.Humanoid.WalkSpeed = 12
if NPC:FindFirstChild("Sword") then
continue
else
NPC.Humanoid:EquipTool(sword)
end
if NPC.Head:FindFirstChildOfClass("Decal").Texture == "rbxassetid://49493144" then
continue
else
NPC.Head:FindFirstChildOfClass("Decal").Texture = "rbxassetid://49493144"
end
end
if CanAttack == false and CanCure == false then
NPC.Head:FindFirstChildOfClass("Decal").Texture = "rbxasset://textures/face.png"
NPC.Humanoid:UnequipTools()
end
if injured and CanCure then
NPC.Humanoid.WalkSpeed = 30
MoveWPath(NPC.Humanoid, newInjuredPath)
if NPC:FindFirstChild("Medkit") then
continue
else
NPC.Humanoid:EquipTool(medkit)
end
if NPC.Head:FindFirstChildOfClass("Decal").Texture == "rbxassetid://22755236" then
continue
else
NPC.Head:FindFirstChildOfClass("Decal").Texture = "rbxassetid://22755236"
end
end
if CanFollow then
MoveWPath(NPC.Humanoid, TorsoPath)
end
end
end)
local secondloop = coroutine.create(function()
while wait(math.random(1, 5)) do
if CanAttack == false and CanCure == false and CanFollow == false then
NPC.Humanoid.WalkSpeed = 16
NPC.Humanoid:MoveTo(NPC.Torso.Position + Vector3.new(math.random(-10, 10), 0, math.random(-10, 10)))
end
end
end)
coroutine.resume(loop)
coroutine.resume(secondloop)
]], NPC)
AI.Name = "AI"
SVW.Parent = AI
MDV.Parent = AI
CA.Parent = AI
CaF.Parent = AI
CC.Parent = AI
return NPC
end
owner.Chatted:Connect(function(m)
local split = m:split("!")
local cmd = split[1]
local value = split[2]
if cmd == "spawn" then
if value then
for i = 1, value do
wait()
SpawnNPC(script)
end
end
elseif cmd == "attack" then
if value then
_G.CanCure = false
if value == "true" then
_G.CanAttack = true
elseif value == "false" then
_G.CanAttack = false
end
end
elseif cmd == "cure" then
if value then
_G.CanAttack = false
if value == "true" then
_G.CanCure = true
elseif value == "false" then
_G.CanCure = false
end
end
elseif cmd == "clear" then
_G.CanAttack = false
_G.CanCure = false
for i, v in next, script:GetChildren() do
v:Destroy()
end
elseif cmd == "follow" then
if value then
if value == "true" then
_G.CanFollow = true
elseif value == "false" then
_G.CanFollow = false
end
end
end
end)
print("Cmds")
print("spawn!number")
print("attack!bool")
print("cure!bool")
print("clear!")
print("follow!bool")