local Q=6 local h=10 local N=require(script.Parent:WaitForChild("\066\097\115\101\077\111\110\115\116\101\114"))return function(H,O)N(H,O,{Health=130;MinDamage=5,MaxDamage=10;DamageCooldown=5;DamageParts={H:WaitForChild("\084\111\114\115\111")}})local U,T=H:WaitForChild("\072\117\109\097\110\111\105\100"),H:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116");(coroutine.wrap(function()while H.Parent and U.Health>0 do wait(math.random(Q,h))for Q,h in pairs(H:GetChildren())do if h:IsA("\066\097\115\101\080\097\114\116")and h.Name=="\069\121\101"then h.BrickColor=BrickColor.new("\066\114\105\103\104\116 \114\101\100")delay(.5,function()h.BrickColor=BrickColor.new("\066\114\105\103\104\116 \121\101\108\108\111\119")end)end end local N=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")N.MaxForce=Vector3.new(math.huge,math.huge,math.huge)N.Velocity=T.CFrame.lookVector*200+Vector3.new(0,50,0)N.Parent=T delay(.5,function()N:Destroy()end)end end))()end
--[[
TheNexusAvenger

Sets up a spider monster.
--]]

local LUNGE_ANIMATION_MIN_COOLDOWN = 6
local LUNGE_ANIMATION_MAX_COOLDOWN = 10

local BaseMonsterSetupFunction = require(script.Parent:WaitForChild("BaseMonster"))



return function(MonsterModel,DungeonPlayers)
    --Set up the base monster.
    BaseMonsterSetupFunction(MonsterModel,DungeonPlayers,{
        Health = 130,
        MinDamage = 5,
        MaxDamage = 10,
        DamageCooldown = 5,
        DamageParts = {MonsterModel:WaitForChild("Torso")},
    })

    --Set up the lunge attack.
    local Humanoid,HumanoidRootPart = MonsterModel:WaitForChild("Humanoid"),MonsterModel:WaitForChild("HumanoidRootPart")
    coroutine.wrap(function()
        while MonsterModel.Parent and Humanoid.Health > 0 do
            wait(math.random(LUNGE_ANIMATION_MIN_COOLDOWN,LUNGE_ANIMATION_MAX_COOLDOWN))

            --Change the color of the eyes.
            for _,Part in pairs(MonsterModel:GetChildren()) do
                if Part:IsA("BasePart") and Part.Name == "Eye" then
                    Part.BrickColor = BrickColor.new("Bright red")
                    delay(0.5,function()
                        Part.BrickColor = BrickColor.new("Bright yellow")
                    end)
                end
            end

            --Run the lunge attack.
            local BodyVelocity = Instance.new("BodyVelocity")
            BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
            BodyVelocity.Velocity = (HumanoidRootPart.CFrame.lookVector * 200) + Vector3.new(0,50,0)
            BodyVelocity.Parent = HumanoidRootPart
            delay(0.5,function()
                BodyVelocity:Destroy()
            end)
        end
    end)()
end