Pivot To Not Working

I’m trying to get a model’s vector3 positions, and then insert them into a table. But then, when I print the table, the table is empty.

local natureNpcPositions = {}

for i, v in pairs(drops:GetChildren()) do
	if v:IsA("Model") then
		table.insert(natureNpcPositions,
			{
				v:GetPivot().X,
				v:GetPivot().Y,
				v:GetPivot().Z
			}
		)
	end
end

print(natureNpcPositions)
1 Like

Add print statements to check if there are any models in ‘drops’. Also, you can store an entire vector3 with Model:GetPivot().Position

1 Like

Hm, can you try printing the “v” or “drops:GetChildren()” and see if it returns anything?

If it does work, after the if statement, try printing “v” to see if they exist. I’d be glad to help!

1 Like

Yeah, all of the models are in the folder. And, they all print things.

1 Like

This issue has been fixed, thank you all for your help. I do not know what the issue was, I just re wrote the script in a different way.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.