-- Переменные для координат спавна крипов local radiantSpawnPoint = Vector3.new(133.165,…
- User
-- Переменные для координат спавна крипов local radiantSpawnPoint = Vector3.new(133.165, 0.5, 47.051) local direSpawnPoint = Vector3.new(-132.107, 0.5, 43.742)
local radiantModels = {} local direModels = {}
local modelFolder = game.ServerStorage:WaitForChild("Creeps")
for _, model in ipairs(modelFolder:GetChildren()) do if model.Name:find("RadiantCreep") then table.insert(radiantModels, model) elseif model.Name:find("DireCreep") then table.insert(direModels, model) end end
local pathfindingService = game:GetService("PathfindingService")
local function spawnCreeps() for _, model in ipairs(radiantModels) do local factionValue = Instance.new("StringValue") factionValue.Name = "Faction" factionValue.Value = "Radiant"
for i = 1, 3 do local creep = model:Clone() creep.Parent = workspace creep.PrimaryPart = creep:FindFirstChild("HumanoidRootPart") creep:SetPrimaryPartCFrame(CFrame.new(radiantSpawnPoint + Vector3.new(i * math.random(2,4), 0, i * math.random(2,4)))) local enemyThrone = workspace.DireAncient local lookVector = (enemyThrone.Position - creep.PrimaryPart.Position).Unit creep:SetPrimaryPartCFrame(CFrame.new(creep.PrimaryPart.Position, creep.PrimaryPart.Position + lookVector)) coroutine.wrap(function() while creep.Parent do if (creep.PrimaryPart.Position - cree.Position).Magnitude <= 10 then -- Начать драться с крипами противоположной фракции for _, enemyCreep in ipairs(direModels) do if enemyCreep.Parent and (enemyCreep.PrimaryPart.Position - creep.PrimaryPart.Position).Magnitude <= 10 then -- Скрипт на драку крипов здесь end end else local path = pathfindingService:CreatePath() path:ComputeAsync(creep.PrimaryPart.Position, enemyThrone.Position) local waypoints = path:GetWaypoints() for i, waypoint in ipairs(waypoints) do creep.Humanoid:MoveTo(waypoint.Position) creep.Humanoid.MoveToFinished:Wait() end end end end)() end end for _, model in ipairs(direModels) do local factionValue = Instance.new("StringValue") factionValue.Name = "Faction" factionValue.Value = "Dire" for i = 1, 3 do local creep = model:Clone() creep.Parent = workspace creep.PrimaryPart = creep:FindFirstChild("HumanoidRootPart") creep:SetPrimaryPartCFrame(CFrame.new(direSpawnPoint + Vector3.new(i * math.random(2,4), 0, i * math.random(2,4)))) local enemyThrone = workspace.RadiantAncient local lookVector = (enemyThrone.Position - creep.PrimaryPart.Position).Unit creep:SetPrimaryPartCFrame(CFrame.new(creep.PrimaryPart.Position, creep.PrimaryPart.Position + lookVector)) coroutine.wrap(function() while creep.Parent do if (creep.PrimaryPart.Position - enemyThrone.Position).Magnitude <= 10 then -- Начать драться с крипами противоположной фракции for _, enemyCreep in ipairs(radiantModels) do if enemyCreep.Parent and (enemyCreep.PrimaryPart.Position - creep.PrimaryPart.Position).Magnitude <= 10 then -- Скрипт на драку крипов здесь end end else local path = pathfindingService:CreatePath() path:ComputeAsync(creep.PrimaryPart.Position, enemyThrone.Position) local waypoints = path:GetWaypoints() for i, waypoint in ipairs(waypoints) do creep.Humanoid:MoveTo(waypoint.Position) creep.Humanoid.MoveToFinished:Wait() end end end end)() end end - Assistant