Loop not going trough table?

Hi!

Somehow this script doesnt loop trough the tables, or i did something wrong… I just can’t figure out what went wrong:

local Tween = require(script.Tween)

local washers = {

washer1 = {
	["Part"] = game.Workspace.Washer1.Main,
	["Orientation"] = Vector3.new(0,90,90)
},

washer2 = {
	["Part"] = game.Workspace.Washer2.Main,
	["Orientation"] = Vector3.new(0,-90,90)
}

}

game.ReplicatedStorage.click.Event:Connect(function()
print("fired")
for i, v in ipairs(washers) do
	local part = v["Part"]
	local orie = v["Orientation"]
	
	print(part.Name)
	print(orie)
	
	Tween.RotateTween(part, orie, 5)
end

end)

Thanks for helping!

ipairs() only work for index-value pairs in tables. Consider changing it to pairs() for also including key-value pairs too.

1 Like

Thanks for the help! That worked!