Hmm, might be tough as it was long ago, Ill send you my current script. Think the tweenservice usage as hum:Moveto
Script in each individual NPC
do
local player = script.Parent:WaitForChild("Player").Value
local hum: Humanoid = script.Parent:WaitForChild("Humanoid")
local points = game:GetService("Workspace"):WaitForChild("BrickSpawn1"):WaitForChild("Builders"):WaitForChild("Points")
local animator: Animator = hum:WaitForChild("Animator")
local run = script.Parent:WaitForChild("Run", 5)
local idle = script.Parent:WaitForChild("Idle", 5)
local sprint = script.Parent:WaitForChild("Sprint", 5)
local hrp: BasePart = hum:FindFirstAncestorOfClass("Model"):FindFirstChild("HumanoidRootPart")
local TweenService = game:GetService("TweenService")
local ar = game:GetService("ReplicatedStorage"):WaitForChild("ClientFXEvents"):WaitForChild("AnimateBuilders")
local upg = require(game:GetService("ServerScriptService").Upgrades)
local rs = game:GetService("RunService")
local bsT = upg.getUpgrade("BuilderSpeed")
local BuilderHandler = require(game:GetService("ServerScriptService").BuilderHandler)
local getLook = BuilderHandler.getLook
local calculateDistanceWalked = BuilderHandler.calculateDistanceWalked
local getRandPoint = BuilderHandler.getRandPoint
-- Math Imports --
local rd = math.round
local sqrt = math.sqrt
local random = math.random
-- --
local WalkToPart = points.Position1
while player and hum do task.wait(0.5)
local bs = bsT[player.Upgrades:WaitForChild("BuilderSpeed").Value][1]
local prv = WalkToPart
local dest = getRandPoint()
if dest == prv then repeat task.wait() dest = getRandPoint() until dest ~= prv end
WalkToPart = dest
local location = Vector3.new(dest.Position.X, hrp.Position.Y, dest.Position.Z)
local xDirection = rd(dest.Position.X - prv.Position.X)
local zDirection = rd(dest.Position.Z - prv.Position.Z)
local look = getLook(xDirection, zDirection, dest)
--
hrp.CFrame = CFrame.new(hrp.Position, look)
if player.Upgrades:WaitForChild("BuilderSpeed").Value < 6 then
ar:FireClient(player, script.Parent, "Run")
else
ar:FireClient(player, script.Parent, "Sprint")
end
local MoveTinfo = TweenInfo.new(calculateDistanceWalked(xDirection, zDirection)/(10+bs*2), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local MoveTween = TweenService:Create(hrp, MoveTinfo, {CFrame = CFrame.new(location, look)})
MoveTween:Play()
MoveTween.Completed:Wait()
MoveTween:Destroy()
ar:FireClient(player, script.Parent, "Idle")
task.wait((6+random(-3, 3))/(1+bs))
end
end
BuilderHanlder Module in ServerScriptService:
local BH = {}
local points = game:GetService("Workspace"):WaitForChild("BrickSpawn1"):WaitForChild("Builders"):WaitForChild("Points")
local rd = math.round
local sqrt = math.sqrt
local random = math.random
-- Formulas --
function BH.calculateDistanceWalked(xDirection: Vector3, zDirection: Vector3)
local result = sqrt((xDirection ^ 2) + (zDirection ^ 2))
return result
end
-- --
function BH.getRandPoint()
local wtp = random(1, 29)
local dest
if wtp == 1 then dest = points.Position1 end
if wtp == 2 then dest = points.Position2 end
if wtp == 3 then dest = points.Position3 end
if wtp == 4 then dest = points.Position4 end
if wtp == 5 then dest = points.Position5 end
if wtp == 6 then dest = points.Position6 end
if wtp == 7 or wtp == 8 then dest = points.Position7 end
if wtp == 9 then dest = points.Position8 end
if wtp == 10 or wtp == 11 then dest = points.Position9 end
if wtp == 12 then dest = points.Position10 end
if wtp == 13 then dest = points.Position11 end
if wtp == 14 then dest = points.Position12 end
if wtp == 15 then dest = points.Position13 end
if wtp == 16 then dest = points.Position14 end
if wtp == 17 then dest = points.Position15 end
if wtp == 18 then dest = points.Position16 end
if wtp == 19 or wtp == 20 then dest = points.Position17 end
if wtp == 21 then dest = points.Position18 end
if wtp == 22 or wtp == 23 then dest = points.Position19 end
if wtp == 24 then dest = points.Position20 end
if wtp == 25 then dest = points.Position21 end
if wtp == 26 then dest = points.Position22 end
if wtp == 27 then dest = points.Position23 end
if wtp == 28 then dest = points.Position24 end
if wtp == 29 then dest = points.Position25 end
return dest
end
function BH.getLook(xDirection, zDirection, dest)
local look = dest.Position
if xDirection == 13 or xDirection == -13 then
if xDirection < 0 then look += Vector3.new(-30, 0, 0) end if xDirection > 0 then look += Vector3.new(30, 0, 0) end if xDirection == 0 then look = Vector3.new(0, look.Y, look.Z) end
end
if zDirection == 13 or zDirection == -13 then
if zDirection < 0 then look += Vector3.new(0, 0, -30) end if zDirection > 0 then look += Vector3.new(0, 0, 30) end if zDirection == 0 then look = Vector3.new(look.X, look.Y, 0) end
end
if xDirection == 26 or xDirection == -26 then
if xDirection < 0 then look += Vector3.new(-60, 0, 0) end if xDirection > 0 then look += Vector3.new(60, 0, 0) end if xDirection == 0 then look = Vector3.new(0, look.Y, look.Z) end
end
if zDirection == 26 or zDirection == -26 then
if zDirection < 0 then look += Vector3.new(0, 0, -60) end if zDirection > 0 then look += Vector3.new(0, 0, 60) end if zDirection == 0 then look = Vector3.new(look.X, look.Y, 0) end
end
if xDirection == 39 or xDirection == -39 then
if xDirection < 0 then look += Vector3.new(-90, 0, 0) end if xDirection > 0 then look += Vector3.new(90, 0, 0) end if xDirection == 0 then look = Vector3.new(0, look.Y, look.Z) end
end
if zDirection == 39 or zDirection == -39 then
if zDirection < 0 then look += Vector3.new(0, 0, -90) end if zDirection > 0 then look += Vector3.new(0, 0, 90) end if zDirection == 0 then look = Vector3.new(look.X, look.Y, 0) end
end
if xDirection == 52 or xDirection == -52 then
if xDirection < 0 then look += Vector3.new(-120, 0, 0) end if xDirection > 0 then look += Vector3.new(120, 0, 0) end if xDirection == 0 then look = Vector3.new(0, look.Y, look.Z) end
end
if zDirection == 52 or zDirection == -52 then
if zDirection < 0 then look += Vector3.new(0, 0, -120) end if zDirection > 0 then look += Vector3.new(0, 0, 120) end if zDirection == 0 then look = Vector3.new(look.X, look.Y, 0) end
end
return look
end
return BH
Ignore any comments, I used them to explain what some things do to a frend
Also: Do note that this is run around 20/s on a somewhat busy server