So recently I got someone to help me out on my latest script it did work but some kind of error was appearing in the output something like this 10:24:07.853 - is not a valid member of Players I'm not sure how to fix this please help me out
for i,x in pairs(game.Workspace.NPCs:GetChildren()) do
x.Region.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local tab = {}
for o,p in pairs(x.QuestLine:GetChildren()) do
for s,q in pairs(p:GetChildren()) do
local texttab = {
Text = q.Value.. " ",
Colored = {},
}
for v,r in pairs(q.Colored:GetChildren()) do
local colortab = {
Word = r.Name.." ",
Color = r.Value,
}
table.insert(texttab.Colored,colortab)
end
table.insert(tab,texttab)
end
game.ReplicatedStorage.NPCSpeak:FireClient(game.Players[hit.Parent.Name],tab)
end
end
end)
end
Please help soon as possible!

3 comments
maybe a npc touched it and triggered the function, cuz npcs also have humanoids
I cant read the script, can you add a code block?
ohh ok