Hey! Sorry I answered a bit late but I have a thought that might be somewhat useful.
So basically, every set amount of time, a object (or npc in your case will move to a set location every time it gets told too, it also moves furthest away from the player(s) and doesn't move to the same space 2 times in a row.
SETUP: Figure it out I'm too lazy sorry i'm doing a skribbl.io tournament lol
Here:
01 | local npcModel = game.Workspace.Crate 1 |
02 | local npcLocationFolder = game.Workspace.GameFolder.DepositFolder |
05 | local npcLocations = crateLocationFolder:GetChildren() |
08 | local function moveNPCToPart(locationPart) |
09 | npcModel:SetPrimaryPartCFrame(locationPart.CFrame) |
12 | local function getTotalPlayerDistanceFromPart(locationPart) |
13 | local totalDistance = 0 |
15 | local players = game.Players:GetPlayers() |
16 | for i = 1 , #players do |
17 | local player = players [ i ] |
18 | local distance = player:DistanceFromCharacter(locationPart.Position) |
19 | totalDistance = totalDistance + distance |
25 | local function changeNPCPosition() |
26 | local greatestDistance = 0 |
27 | local locationPartPicked |
29 | for i = 1 , #npcLocations do |
30 | local locationPart = npcLocations [ i ] |
32 | local distance = getTotalPlayerDistanceFromPart(locationPart) |
33 | if distance > = greatestDistance then |
34 | greatestDistance = distance |
35 | locationPartPicked = locationPart |
40 | moveNPCToPart(locationPartPicked) |
if it breaks just message me and i will see whats wrong
cya :D