Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempting to finds parts in a region prints a table with random numbers instead of parts?

Asked by 5 years ago
local ignorelist = script.Parent.Part,script.Parent.RegionPart

local center = script.Parent.Part.Position

local size = script.Parent.RegionPart.Position

local region = Region3.new((center - size/2),(center + size/2))



local parts = workspace:FindPartsInRegion3(region,ignorelist)



while true do

wait(1)

print(parts)

end

Im new to region3 so I dont know too much about it, but im trying to create a region3 area with a center point. and then Im trying to print whatever is inside of that region. but instead of getting a part name I get this:

table: 0000027F00EF2C40

0
You're just printing out the table, use iteration to iterate through it and then print out what's inside. awfulszn 394 — 5y
0
how can I do that? I looked up "Tables" on the wiki and im not quite sure how this can be used with my current setup. mantorok4866 201 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

What is "table: 0000027F00EF2C40"?

This is the table's hexadecimal memory address. This is perfectly normal. If you want to print the elements of the table, use table.unpack.

lua print(unpack(parts));

There is also table.concat:

lua print(table.concat({'a', 'b', 'c', 'd'}, ", ")); Where ", " is your delimiter that separates each element. It can be anything, even a semicolon (;) for example.

But for that last solution it will not work in this case since it can error if a non-string or non-number is encountered

0
while I was waiting for an answer I found another solution to fit my needs. instead of using region3 to get parts in an area I found out I can just use GetTouchingParts(). but thank you for this answer just in case I need to use region3 in the future. mantorok4866 201 — 5y
Ad

Answer this question