I am making this game where I want NPCs to move randomly in a circular area and I wanted to know if there is a more convenient way to do this than I did? Basically I made a bunch of bricks and used math.random to make the NPC go to a random brick and put those bricks in the circle. I want to know if there is a way to make the NPC move randomly in a constructed circular area and not limited to the points I make.
local NPC = game.Workspace.NPC local pathdeterminer while true do pathdeterminer = "p" .. math.random(1,6) if(pathdeterminer == "p1") then NPC.Humanoid:MoveTo(game.Workspace.Points.p1.Position) NPC.Humanoid.MoveToFinished:Wait() end if(pathdeterminer == "p2") then NPC.Humanoid:MoveTo(game.Workspace.Points.p2.Position) NPC.Humanoid.MoveToFinished:Wait() end if(pathdeterminer == "p3") then NPC.Humanoid:MoveTo(game.Workspace.Points.p3.Position) NPC.Humanoid.MoveToFinished:Wait() end if(pathdeterminer == "p4") then NPC.Humanoid:MoveTo(game.Workspace.Points.p4.Position) NPC.Humanoid.MoveToFinished:Wait() end if(pathdeterminer == "p5") then NPC.Humanoid:MoveTo(game.Workspace.Points.p3.Position) NPC.Humanoid.MoveToFinished:Wait() end if(pathdeterminer == "p6") then NPC.Humanoid:MoveTo(game.Workspace.Points.p4.Position) NPC.Humanoid.MoveToFinished:Wait() end wait(0.5) end
Closed as Primarily Opinion-Based by DeceptiveCaster
This question has been closed because it is a discussion about a topic focused on diverse opinions, which isn't a good fit for our Q&A format.
Why was this question closed?