How to add values into a table?
I'm still new with tables and for loops, I made this to try get the distance of every model in game.Workspace.NPCs but the table doesn't work right this is what it prints:
Distance is 9.7385768890381
Distance is 58.984462738037
Distance is 67.759483337402
table: 1E10DC80
It prints the distances right but the table part just makes it print random letters and numbers each time, how do I fix this?
3 | for number,char in pairs (game.Workspace.NPCs:GetChildren()) do |
4 | local distance = (char.Head.Position - script.Parent.Head.Position).magnitude |
5 | distances [ number ] = distance |
6 | print ( "Distance is " ..distance) |