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

My zombie script stops when the zombie Is cloned In ReplicatedStorage?

Asked by 2 years ago

So this Is a script I made that follows the player:

local NPC = script.Parent

local function FindTarget()
    local maxDistance = 10000
    local target = nil
    for i,v in pairs(workspace:GetChildren()) do
        if v:FindFirstChild("Humanoid") then
            if (v.Head.Position-NPC.Head.Position).magnitude < maxDistance then
                target = v.Head
            end
        end
    end
    return target
end

while wait(0.001) do
    local target = FindTarget()
    if target then
        NPC.Humanoid:MoveTo(target.Position)
    end
end

And as the name says, the script stops whenever the zombie Is cloned In ReplicatedStorage. Got any Ideas?

0
Any type of scripts except ModuleScript don't work on ReplicatedStorage or ServerStorage. NotThatFamouss 605 — 2y

Answer this question