hello all want to make Npc, Like in this picture
where if NPCs spawn, they will line up neatly.
Video NPC
I don’t know where to start, I’m just using this script so how do I get the NPCs to line up neatly?
what should I add to this script and how do I get started?
Script
local NPC = script.Parent
local RunsAim = NPC.Run
local IdleAim = NPC.idle
local RunsAims = NPC.Humanoid:LoadAnimation(RunsAim)
local idleAims = NPC.Humanoid:LoadAnimation(IdleAim)
while true do
wait(0.5)
NPC.Humanoid:MoveTo(script.Parent.Parent.Move1.Position)
NPC.Humanoid.MoveToFinished:wait()
RunsAims:Play()
wait(2)
RunsAims:Stop()
NPC.Humanoid:MoveTo(script.Parent.Parent.Move2.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(2)
RunsAims:Play()
NPC.Humanoid:MoveTo(script.Parent.Parent.Move3.Position)
NPC.Humanoid.MoveToFinished:wait()
RunsAims:Stop()
wait(2)
RunsAims:Stop()
NPC.Humanoid:MoveTo(script.Parent.Parent.Move4.Position)
NPC.Humanoid.MoveToFinished:wait()
RunsAims:Play()
wait(1)
NPC.Humanoid:MoveTo(script.Parent.Parent.Move6.Position)
idleAims:Play()
RunsAims:Stop()
wait(6)
idleAims:Stop()
RunsAims:Play()
NPC.Humanoid:MoveTo(script.Parent.Parent.Exit.Position)
wait(6)
end
cakeycocoa
(StarvinMarvin)
November 2, 2024, 4:38pm
#2
When you spawn in an NPC make him move to the furthest spot in the queue. Whenever an NPC leaves the queue make all the other NPCs move to the next position. This event based approach should work just fine.
1 Like
Your way of doing is not bad too, you can play with some numbers to make it work, but there are several answers made for the same topic too, somewhat more professional ways, here are some of them:
I would try this, first do not use only 7 spots for the line.
Each spot should be behind each NPC. So when a NPC already reached the last line spot, the NPC becomes the new last line spot.
Watch this image:
[image]
Theres a starter spot for the cashout (a green part)
You would have that part as a reference where all NPC should have to try to reach when they are ready to use the cashout.
Once a NPC reached that spot, in script you change the reference of that spot, turn it into the yellow …
If you want to line a bunch of NPCs up, using Humanoid:MoveTo with relative destination values on several humanoids should do the trick.
Here’s an annotated script that pretty much covers everything:
local debris = game:GetService'Debris';
local npc = game.ServerStorage:WaitForChild'Rig'; --can be chosen at random instead
local origin = Vector3.new(20, 0, 20); --place in which our npcs will spawn at
local exit = -origin; --place in which our npcs leave to
local line = { --storage of all our…
Also use task.wait()
instead of wait()
if you just want to yield the thread for a specific period of time, it’s more accurate and efficient.
2 Likes
thank you very much your answer is very helpful to me
1 Like