How to table.insert() a varible into a dictionary

Hello! I’ve been creating a time stop script and i’ve been trying table.insert() to get a dictionary of baseParts and are they anchored and I’ve been trying methods from the devforum and videos but none of them solved my issue. How can I add a new varible into a dictionary?

1 Like

is this what you are trying to do?

table.insert(TABLENAMEHERE, basePart)

No I’m trying to save the basePart previous anchored state by using empty dictionaries and I’m trying to insert a varible into it.

table.insert(table, v== v.Anchord) -- It's in a for loop so v is the basePart

is the tables name “table”?

if so that could cause an error because “table” is pre defined by roblox

no that is an example name of the table

Let me know if this works, typing this out in dev forum.

local parts = {}

for i, part in ipairs(workspace:GetChildren()) do
	if part:IsA("BasePart") then
		table.insert(parts, part.Anchored)
	end
end

--do whatever you wanted
print(parts)

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