0

# CollectionService is not using everyone properly?

Im making a game where the npcs stare at you and I am trying to use CollectionService to make all the npcs look at the player but only one is facing the player. This is the script:

RunService = game:GetService("RunService")
CollectionService = game:GetService("CollectionService")

plr = game.Players:GetChildren()

for _, Player in plr do

plr = Player
break

end

for _, NPCs in CollectionService:GetTagged("NPC Stare") do

NPCSS = game.Workspace:GetChildren("NPCs")

print("HERE")

RunService.Heartbeat:Connect(function()
local npcPosition = game.Workspace.NPCs.NPC.PrimaryPart.Position
local targetPosition = plr.Character.Torso.Position