Distance calculation script not working

Hi im trying to write a script where an npc goes to any goal(part) within a specified range

can u paste the full script please

Its this part i need help with

Hi! I see some strange stuff in script, can you please explain what’s going wrong in details?

Im trying to print the table for debugging purposes.

And what’s going wrong? It returns an error, don’t print anything, prints weird stuff?

It prints weird stuff in the output

If you mean something like this:
image
then it’s beause you insterting table in table
table.insert(goalparts, {goal})
__________________________^^^

In the dev console it prints encoded garbage,

This?
image
If yes, you need to turn off log mode on the right side of output (three dots)

By doing

{goal}

You’re putting it inside a table. So when you print goal parts, you’re not printing a table of goals, your printing a table of tables.

Unless this is intended, then It should be

table.insert(goalparts, goal)

-- and the print too
print(goalparts, goal)
1 Like