Hello Helpers!
I'm trying to move an ImageButton to a certain position, the problem is that I can not make it to return to it starting position every time when I click to another ImageButton
I wanna put the current ImageButton(Obj2).position to a table and make it return to they original position whatever i click to a not equipped GUI
local Empty = false
local Positions = {}
for i,Obj2 in pairs(Gui.Frame:GetChildren())
table.insert(Positions,Obj2.Position.X and Obj2.Position.Y)
Obj2.MouseButton1Down:connect(function()
if Empty == false and Obj2.IsEquipped.Value == false then
Obj2:TweenPosition(UDim2.new(0.5,-35,1,-70), "Out", "Quad",1) -- equip position
Obj2.IsEquipped.Value = true
player.Character.Humanoid:EquipTool(v)
wait(1)
elseif Obj2.IsEquipped.Value == true then
Obj2:TweenPosition(UDim2.new(Positions[i]), "In", "Quad",1) -- it's not returning to the original position
player.Character.Humanoid:UnequipTools()
wait(1)
Obj2.IsEquipped.Value = false
end
end)
end
it's moving the ImageButton to position (0,0,0,0) and not to the original position, after the change :(
Sorry, English isn’t my first language.

9 comments
I think the problem is that you have never assigned a UDim2 value to the variable "Positions".
Obj2:TweenPosition(Positions[1], "In", "Quad",1) =)
Oh, it's a table. I didn't notice that.
But it's still empty.
The table is not empty via line 3, the two errors are that 1st hes referencing a table and not the value in the table itself and 2nd that Obj2.Position is a UDim2 value already so there's no need for the UDim2.new() anyway
So it's table.insert("Table", "Value you want to insert")? If that's correct, he could just make a variable to store the position instead of create a table, right?
now the table is not empty, i made this -- table.insert(Positions,Obj2.Position.X and Obj2.Position.Y) its printing the right position, but i still confused to make it return to original position
i make it! thank you guys for help
He could've just made it a variable of course, but he didn't and i'm going off what he did do