#How can I make it so the Classic Roblox Zombie doesnt attack or follow me into a safezone?

5 messages · Page 1 of 1 (latest)

azure heath
#

The Script:

local zombie = script.Parent

for _, script in pairs(zombie.ModuleScripts:GetChildren()) do
    if not game.ServerStorage:FindFirstChild(script.Name) then
        script:Clone().Parent = game.ServerStorage
    end
end

local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie)
local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)


local function clearParts(parent)
    for _, part in pairs(parent:GetChildren()) do
        clearParts(part)
    end
    local delay
    if parent:IsA("Part") then
        delay = math.random(5,10)
    else
        delay = 11
    end
    DestroyService:AddItem(parent, delay)
end

zombie.Humanoid.Died:connect(function()
    AI.Stop()
    math.randomseed(tick())
    clearParts(zombie)
    script.Disabled = true
end)

local lastMoan = os.time()
math.randomseed(os.time())
while true do
    local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)
    animationTrack:Play()
    --    local now = os.time()
    --    if now - lastMoan > 5 then    
    --        if math.random() > .3 then
    --            zombie.Moan:Play()
    ----            print("playing moan")
    --            lastMoan = now
    --        end
    --    end
    wait(2)
end
craggy nacelle
#

add a bool value to ur character

#

whenever u enter a safezone make the boolvalue true

#

and add a script in the zombie that checks only if the player boolvalue is false that it can be a target

heavy arch
#

Or you can use region 3 dat like getpartsinboundbox and check if it is contains the safe zone getpartsinboundbox returns a list of all things touching what params you put in