Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would you make the basic ROBLOX drooling zombie not kill other zombies?

Asked by 4 years ago

I'm trying to make a zombie - type game, and when I test it, it goes well, but the Zombies keep killing each other when they're in a certain radius. Here's the script, and what should I do to prevent this issue?

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


0
I'm only using this script and put it in my own model. VolcaronticYT 5 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You can make a table of lists with the zombie names and make it so a for loop is active on that list then you would simply just let them ignore them. This would be the tricky part but it's possible and very easily done. You can also put them on the same team or tweak their script inside of the model itself. One with the able would look like this:

local tableHere = {
--Zombie Names
}


for i, v in pairs(tableHere) do
-- Run Code and use v to ignore them.
end

Any other ideas go to youtube or developer.roblox / the dev fourm for more information about this topic.

Ad

Answer this question