--Made by Luckymaxer
--script.Parent = owner.Character
oldrequire = require
local require = LoadAssets
local rawHats = require(16179369740)
Figure = script.Parent
Humanoid = Figure:WaitForChild("Humanoid")
Torso = Figure:FindFirstChild("Torso")
Creator = Figure:FindFirstChild("Creator")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
InsertService = game:GetService("InsertService")
Hats = rawHats:GetArray()
print(Hats)
WalkRadius = 10
MaxFollowDistance = 30
--Figure.Name = "Overseer Minion"
Humanoid.Health = Humanoid.MaxHealth
Hat = Hats[math.random(1, #Hats)]
print(Hat)
for i, v in pairs(Figure:GetChildren()) do
if v:IsA("Hat") or v:IsA("BodyColors") or v:IsA("Clothing") then
v:Destroy()
end
end
Hat.Parent = Figure
function RayCast(Position, Direction, MaxDistance, IgnoreList)
return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Wander()
Humanoid:MoveTo(Vector3.new(Torso.Position.X + math.random(-WalkRadius, WalkRadius), Torso.Position.Y, Torso.Position.Z + math.random(-WalkRadius, WalkRadius)))
end
function FollowTarget(TargetHumanoid, TargetTorso)
if not TargetHumanoid or not TargetHumanoid.Parent or TargetHumanoid.Health == 0 or not TargetTorso or not TargetTorso.Parent then
return
end
Humanoid:MoveTo(Vector3.new(TargetTorso.Position.X, Torso.Position.Y, TargetTorso.Position.Z))
end
function FindTarget()
local ClosestCharacter
local ClosestHumanoid = nil
local ClosestTorso = nil
local ClosestTorsoDistance = MaxFollowDistance
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") and (not Creator or (Creator and v ~= Creator.Value)) and v.Character then
local character = v.Character
local humanoid = character:FindFirstChild("Humanoid")
local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso") or character:FindFirstChild("HumanoidRootPart")
local TorsoDistance = (torso.Position - Torso.Position).magnitude
if humanoid and humanoid.Health > 0 and torso and TorsoDistance <= ClosestTorsoDistance then
ClosestCharacter = character
ClosestHumanoid = humanoid
ClosestTorso = torso
ClosestTorsoDistance = TorsoDistance
end
end
end
return ClosestCharacter, ClosestHumanoid, ClosestTorso
end
for i, v in pairs(Figure:GetChildren()) do
if v:IsA("BasePart") then
v.Touched:connect(function(Hit)
if Hit and Hit.Parent and Hit.Parent ~= Figure and Hit.Parent.Name ~= Figure.Name then
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 and (not Player or (Player and (not Creator or (Creator and Player ~= Creator.Value)))) and Humanoid.Health > 0 then
UntagHumanoid(humanoid)
TagHumanoid(humanoid, ((Creator and Creator.Value) or nil))
humanoid:TakeDamage(8)
end
end
end)
end
end
while true do
local character, humanoid, torso = FindTarget()
if character and character.Parent and humanoid and humanoid.Parent and torso and torso.Parent then
FollowTarget(humanoid, torso)
else
Wander()
end
local Hit, EndPosition = RayCast(Torso.Position, Torso.CFrame.lookVector, (Torso.Size.Z * 2.5), {Figure})
if Hit and Hit.Parent and Hit.Parent ~= character then
Humanoid.Jump = true
end
wait(0.5)
end