Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local prefix = "/"
- local function command(name, f)
- owner.Chatted:connect(function(v)
- local nl = name:len() + 1
- if v:len() >= nl and v:sub(1, 1) == prefix and v:sub(2, nl) == name then
- local chunks = {}
- for substring in v:sub(nl + 1):gmatch("%S+") do
- table.insert(chunks, substring)
- end
- f(unpack(chunks))
- end
- end)
- end
- model = Instance.new("Model",workspace)
- command("bots", function(number)
- bots = { }
- for i = 1, tonumber(number) do
- local blocks = Instance.new("Part",model)
- blocks.Size = Vector3.new(1,1,1)
- blocks.Color = Color3.fromRGB(0, 0, 0)
- blocks.CFrame = owner.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-5)
- AgentRadius = tonumber(blocks.Size.Z)
- AgentHeight = tonumber(blocks.Size.Y)
- table.insert(bots,blocks)
- end
- end)
- command("target", function(obj)
- if game.Workspace[obj] ~= nil then
- for i,v in pairs(bots) do
- function Pathf()
- local pathFinder = game:GetService("PathfindingService")
- while true do
- wait()
- local path = pathFinder:CreatePath(AgentRadius,AgentHeight,false)
- if game.Workspace[obj]:FindFirstChild("HumanoidRootPart") then
- path:ComputeAsync(v.Position,game.Workspace[obj].HumanoidRootPart.Position)
- else
- path:ComputeAsync(v.Position,game.Workspace[obj].Position)
- end
- if path.Status == Enum.PathStatus.Success then
- else
- print("Trying again")
- return Pathf()
- end
- local pathpoints = path:GetWaypoints()
- for j = 1,#pathpoints do
- for l = 0,1,.01 do
- wait(.01)
- v.Position = v.Position:Lerp(pathpoints[j].Position,l)
- wait()
- end
- end
- end
- end
- spawn(Pathf)
- end
- end
- end)
- command("del_bots", function(numbah)
- local blockbots = model:GetChildren()
- for i = 1, tonumber(numbah) do
- blockbots[i]:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement