I'm trying to get this NPC to get a random name when a function is called, heres my script
The names that I want to choose from are in a folder called NameList
function ChooseName()
local names = (game.ServerStorage.NameList:GetChildren().name)
local name = names[math.random(1,#names)]
print(name)
script.Parent.Name = name
end
ChooseName()
This is an error I get, Workspace.NPC.Name:4: attempt to get length of a nil value

2 comments
I think you can just use strings instead
Change line 7 to script.Parent.Name = name.Name