for i,v in pairs(buttons:GetChildren()) do
v.MouseEnter:Connect(function()
local xscale = v.Position.X.Scale
--1
local f1=Instance.new("Frame")
f1.Parent = gui
f1.BorderSizePixel = 0
f1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
f1.Size = UDim2.new(0.014,0,0,0)
f1.Position = UDim2.new(xscale + 0.293, 0, v.Position.Y.Scale, 0)
print(f1.Position)
--2
local f2=Instance.new("Frame")
f2.Parent = gui
f2.BorderSizePixel = 0
f2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
f2.Size = UDim2.new(0.014,0,0,0)
f2.Position = UDim2.new(xscale + 0.293, 0, v.Position.Y.Scale + 0.119, 0)
--tween
f1:TweenSize(UDim2.new(0.014, 0, 0.06, 0), "In","Linear",0.2,true)
f2:TweenSize(UDim2.new(0.014, 0, -0.06, 0), "In","Linear",0.2,true)
return f1,f2
end)
How would I acquire f1 and f2 from this piece of code so I can use it outside the function? Thanks.

2 comments
What purpose do you want to use f1 and f2 for? What kind of code would use them?
I want to destroy the frames when the Mouse Leaves the button.